Skip to content

Commit

Permalink
Now flush on startup and no on every metrics.
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasmaurice committed Feb 18, 2024
1 parent 7a02f0a commit 41b0f55
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions satisfactory-metadata/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ func initDB(db *sql.DB) error {
frm_data jsonb
);
CREATE INDEX IF NOT EXISTS cache_metric_idx ON cache(metric);
FLUSH cache;
`)
if err != nil {
fmt.Println("Error while creating DB Table : ", err)
Expand Down Expand Up @@ -135,11 +136,6 @@ func cacheMetrics(db *sql.DB, metric string, data []string) (err error) {
}
}()

delete := `delete from cache where metric = $1;`
_, err = tx.Exec(delete, metric)
if err != nil {
return
}
for _, s := range data {
insert := `insert into cache (metric, frm_data) values($1, $2)`
_, err = tx.Exec(insert, metric, s)
Expand Down

0 comments on commit 41b0f55

Please sign in to comment.