Skip to content
Snippets Groups Projects
Commit 4f0368b6 authored by Patrick Steinhardt's avatar Patrick Steinhardt
Browse files

datastore: Fix storage cleanup's handling of timezones

Timestamps in the `storage_cleanups` table are stored without timezones,
but our timezone handling in `AcquireNextStorage()` is inconsistent: we
typically just use `NOW()` to get the current timestamp, but in one case
we use `NOW() AT TIME ZONE 'UTC'`. In some setups, this leads to time
stamps which cannot be correctly compared with each other.

Fix the bug by consistently storing time stamps without time zones. This
bug is similar to 4a2ac0ed (datastore: Fix acknowledgement of stale
jobs considering timezones, 2021-08-20).

Changelog: fixed
parent cd94be7f
No related branches found
No related tags found
1 merge request!3930datastore: Fix storage cleanup's handling of timezones
......@@ -71,7 +71,7 @@ func (ss *StorageCleanup) AcquireNextStorage(ctx context.Context, inactive, upda
if err := ss.db.QueryRowContext(
ctx,
`UPDATE storage_cleanups
SET triggered_at = (NOW() AT TIME ZONE 'UTC')
SET triggered_at = NOW()
WHERE (virtual_storage, storage) IN (
SELECT virtual_storage, storage
FROM storage_cleanups
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment