Created
January 31, 2023 19:27
-
-
Save reidab/96485934a0339225f1eca22e2d33e752 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/app/workers/scan_result_worker.rb b/app/workers/scan_result_worker.rb | |
index 5598512e5..f71afb160 100644 | |
--- a/app/workers/scan_result_worker.rb | |
+++ b/app/workers/scan_result_worker.rb | |
@@ -5,17 +5,15 @@ class ScanResultWorker | |
include Sidekiq::Worker | |
include Sidekiq::Throttled::Worker | |
- sidekiq_options queue: :dyrt_alerts, retry: 0 | |
+ sidekiq_options queue: :dyrt_alerts, | |
+ retry: 0, | |
+ lock: :until_executed, | |
+ lock_args_method: ->(args) { args[0..1] } | |
+ | |
def perform(campground_id, availability_scan_id, scheduled_at = nil) | |
log_latency(campground_id, availability_scan_id, scheduled_at) | |
- # TODO: Refine to be more precise based on scan plan timing | |
- if scheduled_at.present? | |
- scheduled_time = Time.at(scheduled_at).utc | |
- return if (Time.now.utc - scheduled_time) > 5.minutes | |
- end | |
- | |
Campground.with_advisory_lock("campground_#{campground_id}_availability_scan") do | |
availability_scan = AvailabilityScan.find(availability_scan_id) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment