ajoute snapshot
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
c73021a14f
commit
0f2d7126eb
11 changed files with 862 additions and 19 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue