FIX: Correct stale duration logic

FIX: Correct stale duration logic

We want STALE_DURATION.minute.ago, not STALE_DURATION.minute.since

Also revert temporary increase from a517d4e64b977fff52aa5955a11677df6b4d84e1

diff --git a/app/jobs/regular/process_grouped_alerts.rb b/app/jobs/regular/process_grouped_alerts.rb
index 1eec3fe..9f78733 100644
--- a/app/jobs/regular/process_grouped_alerts.rb
+++ b/app/jobs/regular/process_grouped_alerts.rb
@@ -6,7 +6,7 @@ module Jobs
 
     include AlertPostMixin
 
-    STALE_DURATION = 2880.freeze
+    STALE_DURATION = 5.freeze
 
     def execute(args)
       token = args[:token]
@@ -55,7 +55,7 @@ module Jobs
               end
 
               if is_stale &&
-                STALE_DURATION.minute.since > DateTime.parse(alert["starts_at"])
+                STALE_DURATION.minute.ago > DateTime.parse(alert["starts_at"])
 
                 alert["status"] = "stale"
                 updated = true

GitHub sha: 5d4d4f29

1 Like