ajoute snapshot

Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
GnomeZworc 2026-06-13 22:52:13 +02:00
commit 0f2d7126eb
Signed by: nicolas.boufideline
GPG key ID: 4406BBBF8845D632
11 changed files with 862 additions and 19 deletions

View file

@ -14,6 +14,7 @@ import (
"git.g3e.fr/H6N/account/internal/pipeline"
"git.g3e.fr/H6N/account/internal/scheduler"
"git.g3e.fr/H6N/account/internal/server"
"git.g3e.fr/H6N/account/internal/snapshot"
"git.g3e.fr/H6N/account/internal/store"
"github.com/jackc/pgx/v5/pgxpool"
)
@ -40,6 +41,7 @@ func main() {
logger.Info("database connected")
st := store.New(pool)
snap := snapshot.New(st, logger, cfg.SnapshotHorizonDays)
pl := pipeline.New(st, pipeline.Config{
OpenFIGIKey: cfg.OpenFIGIKey,
CoinGeckoKey: cfg.CoinGeckoKey,
@ -56,6 +58,11 @@ func main() {
Interval: cfg.PriceCleanInterval,
Fn: pl.CleanHistory,
})
sched.Add(scheduler.Job{
Name: "daily-snapshot",
Interval: 24 * time.Hour,
Fn: snap.DailySnapshot,
})
sched.Start(ctx)
srv := server.New(cfg, pool, logger)