Skip to content

Commit

Permalink
Add lock expiration to Sidekiq workers
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew committed Nov 22, 2024
1 parent 788c50c commit 7a6794d
Show file tree
Hide file tree
Showing 14 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion app/sidekiq/download_tags_worker.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class DownloadTagsWorker
include Sidekiq::Worker
sidekiq_options queue: 'tags', lock: :until_executed
sidekiq_options queue: 'tags', lock: :until_executed, lock_expiration: 1.day.to_i

def perform(repository_id)
Repository.find_by_id(repository_id).try(:download_tags)
Expand Down
2 changes: 1 addition & 1 deletion app/sidekiq/package_usage_sync_worker.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class PackageUsageSyncWorker
include Sidekiq::Worker
sidekiq_options lock: :until_executed
sidekiq_options lock: :until_executed, lock_expiration: 1.day.to_i

def perform(package_usage_id)
PackageUsage.find_by_id(package_usage_id).try(:sync)
Expand Down
2 changes: 1 addition & 1 deletion app/sidekiq/parse_dependencies_worker.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class ParseDependenciesWorker
include Sidekiq::Worker
sidekiq_options queue: 'dependencies', lock: :until_executed
sidekiq_options queue: 'dependencies', lock: :until_executed, lock_expiration: 1.day.to_i

def perform(repository_id)
Repository.includes(manifests: :dependencies).find_by_id(repository_id).try(:parse_dependencies)
Expand Down
2 changes: 1 addition & 1 deletion app/sidekiq/parse_tag_dependencies_worker.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class ParseTagDependenciesWorker
include Sidekiq::Worker
sidekiq_options queue: 'dependencies', lock: :until_executed
sidekiq_options queue: 'dependencies', lock: :until_executed, lock_expiration: 1.day.to_i

def perform(tag_id)
Tag.includes(manifests: :dependencies).find_by_id(tag_id).try(:parse_dependencies)
Expand Down
2 changes: 1 addition & 1 deletion app/sidekiq/ping_owner_worker.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class PingOwnerWorker
include Sidekiq::Worker
sidekiq_options queue: :ping, lock: :until_executed
sidekiq_options queue: :ping, lock: :until_executed, lock_expiration: 1.day.to_i

def perform(host_name, full_name)
host = Host.find_by_name(host_name)
Expand Down
2 changes: 1 addition & 1 deletion app/sidekiq/ping_packages_worker.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class PingPackagesWorker
include Sidekiq::Worker
sidekiq_options queue: :default, lock: :until_executed
sidekiq_options queue: :default, lock: :until_executed, lock_expiration: 1.day.to_i

def perform(repo_id)
Repository.find_by_id(repo_id).try(:ping_packages)
Expand Down
2 changes: 1 addition & 1 deletion app/sidekiq/ping_worker.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class PingWorker
include Sidekiq::Worker
sidekiq_options queue: :ping, lock: :until_executed
sidekiq_options queue: :ping, lock: :until_executed, lock_expiration: 1.day.to_i

def perform(host_name, full_name)
host = Host.find_by_name(host_name)
Expand Down
2 changes: 1 addition & 1 deletion app/sidekiq/repository_usage_worker.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class RepositoryUsageWorker
include Sidekiq::Worker
sidekiq_options lock: :until_executed
sidekiq_options lock: :until_executed, lock_expiration: 1.day.to_i

def perform(repository_id)
repository = Repository.find(repository_id)
Expand Down
2 changes: 1 addition & 1 deletion app/sidekiq/sync_commit_stats_worker.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class SyncCommitStatsWorker
include Sidekiq::Worker
sidekiq_options lock: :until_executed
sidekiq_options lock: :until_executed, lock_expiration: 1.day.to_i

def perform(repository_id)
Repository.find_by_id(repository_id).try(:sync_commit_stats)
Expand Down
2 changes: 1 addition & 1 deletion app/sidekiq/sync_extra_details_worker.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class SyncExtraDetailsWorker
include Sidekiq::Worker
sidekiq_options queue: 'extra', lock: :until_executed
sidekiq_options queue: 'extra', lock: :until_executed, lock_expiration: 1.day.to_i

def perform(repository_id)
Repository.find_by_id(repository_id).try(:sync_extra_details)
Expand Down
2 changes: 1 addition & 1 deletion app/sidekiq/sync_owner_worker.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class SyncOwnerWorker
include Sidekiq::Worker
sidekiq_options lock: :until_executed
sidekiq_options lock: :until_executed, lock_expiration: 1.day.to_i

def perform(host_id, login)
Host.find_by_id(host_id).try(:sync_owner, login)
Expand Down
2 changes: 1 addition & 1 deletion app/sidekiq/sync_repository_worker.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class SyncRepositoryWorker
include Sidekiq::Worker
sidekiq_options lock: :until_executed
sidekiq_options lock: :until_executed, lock_expiration: 1.day.to_i

def perform(host_id, full_name)
Host.find_by_id(host_id).try(:sync_repository, full_name)
Expand Down
2 changes: 1 addition & 1 deletion app/sidekiq/update_metadata_files_worker.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class UpdateMetadataFilesWorker
include Sidekiq::Worker
sidekiq_options lock: :until_executed
sidekiq_options lock: :until_executed, lock_expiration: 1.day.to_i

def perform(repo_id)
Repository.find_by_id(repo_id).try(:update_metadata_files)
Expand Down
2 changes: 1 addition & 1 deletion app/sidekiq/update_repository_worker.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class UpdateRepositoryWorker
include Sidekiq::Worker
sidekiq_options lock: :until_executed
sidekiq_options lock: :until_executed, lock_expiration: 1.day.to_i

def perform(repo_id)
Repository.find_by_id(repo_id).try(:sync)
Expand Down

0 comments on commit 7a6794d

Please sign in to comment.