From 41b0f55c3bcdcf4aad903eabd6e81432ca7ee6a9 Mon Sep 17 00:00:00 2001 From: Sonic Lucas Maurice Date: Sun, 18 Feb 2024 17:45:02 -0500 Subject: [PATCH] Now flush on startup and no on every metrics. --- satisfactory-metadata/main.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/satisfactory-metadata/main.go b/satisfactory-metadata/main.go index d726f7f..09079ed 100644 --- a/satisfactory-metadata/main.go +++ b/satisfactory-metadata/main.go @@ -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) @@ -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)