mirror of
https://github.com/trafficlunar/api.git
synced 2026-08-12 12:29:39 +00:00
feat: data store
This commit is contained in:
parent
4f8ee6cf9c
commit
19bdd27de1
8 changed files with 123 additions and 53 deletions
17
internal/worker/datastore.go
Normal file
17
internal/worker/datastore.go
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
package worker
|
||||
|
||||
import (
|
||||
"api/internal/storage"
|
||||
"log/slog"
|
||||
"time"
|
||||
)
|
||||
|
||||
func StartDataStoreWorker() {
|
||||
slog.Info("Starting data store worker...")
|
||||
|
||||
for range time.Tick(1 * time.Minute) {
|
||||
if err := storage.GlobalDataStore.Save(); err != nil {
|
||||
slog.Error("Error saving data store", slog.Any("error", err))
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue