everywhere: add option to export data

This commit is contained in:
Adhityaa Chandrasekar
2019-01-31 02:06:11 -05:00
parent f1ece27c99
commit fff5e5c0e1
16 changed files with 361 additions and 30 deletions

View File

@@ -0,0 +1,25 @@
package main
import (
"time"
)
func domainExportCleanupBegin() error {
go func() {
for {
statement := `
DELETE FROM exports
WHERE creationDate < $1;
`
_, err := db.Exec(statement, time.Now().UTC().AddDate(0, -7, 0))
if err != nil {
logger.Errorf("error cleaning up export rows: %v", err)
return
}
time.Sleep(2 * time.Hour)
}
}()
return nil
}