From 5cadd954aa9b9b12d1d7f03ff8d3ba6aac3ed6b5 Mon Sep 17 00:00:00 2001 From: Patrick Pfeiffer Date: Thu, 15 Feb 2024 13:45:10 +0100 Subject: [PATCH] (BIDS-2872) wip --- ratelimit/ratelimit.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ratelimit/ratelimit.go b/ratelimit/ratelimit.go index 7a7558c406..7b6a53f651 100644 --- a/ratelimit/ratelimit.go +++ b/ratelimit/ratelimit.go @@ -1070,9 +1070,9 @@ func DBUpdateApiRatelimits() (sql.Result, error) { insert into api_ratelimits (user_id, second, hour, month, valid_until, changed_at) select user_id, - max(second) as second, - max(hour) as hour, - max(month) as month, + case when min(second) = 0 then 0 else max(second) end as second, + case when min(hour) = 0 then 0 else max(hour) end as hour, + case when min(month) = 0 then 0 else max(month) end as month, to_timestamp('9999-12-31 23:59:59', 'YYYY-MM-DD HH24:MI:SS') as valid_until, now() as changed_at from (