-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3004 from alphagov/dependabot/bundler/sidekiq-7.3.2
Bump sidekiq from 6.5.12 to 7.3.2
- Loading branch information
Showing
36 changed files
with
175 additions
and
168 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
require "govuk_sidekiq/sidekiq_initializer" | ||
|
||
GovukSidekiq::SidekiqInitializer.setup_sidekiq( | ||
"search-api", | ||
{ url: ENV.fetch("REDIS_URL", "redis://127.0.0.1:6379") }, | ||
) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
class BaseJob | ||
include Sidekiq::Job | ||
|
||
# How long to wait, by default, if the index is currently locked | ||
LOCK_DELAY = 60 # seconds | ||
|
||
# Default options: can be overridden with `sidekiq_options` in subclasses | ||
sidekiq_options retry: 5, backtrace: 12 | ||
|
||
def self.notify_of_failures | ||
sidekiq_retries_exhausted do |msg| | ||
GovukError.notify(Indexer::FailedJobException.new, extra: msg) | ||
end | ||
end | ||
|
||
# Wait for all tasks for the given queue/job class combination to be | ||
# completed before continuing | ||
def self.wait_until_processed(max_timeout: 2 * 60 * 60) | ||
Timeout.timeout(max_timeout) do | ||
# wait for all queued tasks to be started | ||
sleep 1 while Sidekiq::Queue.new(self::QUEUE_NAME).any? { |job| job.display_class == to_s } | ||
|
||
# wait for started tasks to be finished | ||
sleep 1 while active_jobs? | ||
end | ||
end | ||
|
||
def self.active_jobs? | ||
Sidekiq::Job.jobs.any? do |_, _, work| | ||
work["queue"] == self::QUEUE_NAME && work["payload"]["class"] == to_s | ||
end | ||
end | ||
|
||
private | ||
|
||
def indexes(index_name) | ||
SearchConfig.search_servers.map do |search_server| | ||
search_server.index(index_name) | ||
end | ||
end | ||
end |
2 changes: 1 addition & 1 deletion
2
lib/govuk_index/page_traffic_worker.rb → lib/govuk_index/page_traffic_job.rb
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
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
2 changes: 1 addition & 1 deletion
2
lib/govuk_index/popularity_worker.rb → lib/govuk_index/popularity_job.rb
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
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
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
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
2 changes: 1 addition & 1 deletion
2
lib/govuk_index/supertype_worker.rb → lib/govuk_index/supertype_job.rb
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
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
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
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
2 changes: 1 addition & 1 deletion
2
lib/indexer/workers/bulk_index_worker.rb → lib/indexer/bulk_index_job.rb
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
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
2 changes: 1 addition & 1 deletion
2
lib/indexer/workers/delete_worker.rb → lib/indexer/delete_job.rb
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
This file was deleted.
Oops, something went wrong.
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
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
Oops, something went wrong.