diff --git a/main.go b/main.go index 5b019ce..8c7f0d2 100644 --- a/main.go +++ b/main.go @@ -157,10 +157,10 @@ func (app app) mainLoop(ctx context.Context) { logger.Error("crawlAndPostprocess", err) } - err := app.archiveOldStatsData(ctx) - if err != nil { - app.logger.Error("archiveOldStatsData", err) - } + // err := app.archiveOldStatsData(ctx) + // if err != nil { + // app.logger.Error("archiveOldStatsData", err) + // } app.logger.Debug("Finished crawl and postprocess") diff --git a/sql/delete-old-data.sql b/sql/delete-old-data.sql index ce5f57b..5f113e0 100644 --- a/sql/delete-old-data.sql +++ b/sql/delete-old-data.sql @@ -1,4 +1,5 @@ -- delete data older than one month. It's taking about 18 days to fill a gig, and we have -- 3 gig volume currently. That gives us 54 days. But 30 days is plenty and this gives us margin -- in case the rate of growth of data increases. -delete from dataset where sampletime <= unixepoch()-30*24*60*60 +delete from dataset where ids in (select distinct id from dataset where sampletime <= unixepoch()-28*24*60*60); +update dataset set archived = 0;