This commit is contained in:
41666 2024-11-13 19:26:55 -08:00
parent 0fa1de3b4e
commit a755b4d2c8
6 changed files with 59 additions and 15 deletions

View file

@ -147,9 +147,12 @@ func (ps *VehicleStore) Prune(ctx context.Context) (int64, error) {
// Avoid using sql idioms here for portability
// SQLite and PgSQL do now() differently, we don't need to at all.
res, err := ps.DB.ExecContext(ctx, `
DELETE FROM vehicles WHERE last_updated < $1;
`, time.Now().Add(-time.Minute*15))
res, err := ps.DB.ExecContext(ctx,
`
DELETE FROM vehicles WHERE last_updated < $1;
`,
util.TimeToString(time.Now().Add(-time.Minute*15)),
)
if err != nil {
return 0, err
}