Skip to content

Commit

Permalink
Remove retrying on updating a package
Browse files Browse the repository at this point in the history
If updating a package results in an error, just retrying 10 times to
update it doesn't make a difference.

Correct handling of concurrent updates of packages is guaranteed using
Active Jobs.
  • Loading branch information
eduardoj committed Jan 24, 2025
1 parent 5fa8e00 commit 4c8b5f9
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions src/api/app/models/package.rb
Original file line number Diff line number Diff line change
Expand Up @@ -460,18 +460,8 @@ def sources_changed(opts = {})
if opts[:wait_for_update]
update_if_dirty
else
retries = 10
begin
# NOTE: Its important that this job run in queue 'default' in order to avoid concurrency
PackageUpdateIfDirtyJob.perform_later(id)
rescue ActiveRecord::StatementInvalid => e
# mysql lock errors in delayed job handling... we need to retry
retries -= 1
if retries.positive?
Airbrake.notify("Failed while running PackageUpdateIfDirtyJob: retries left: #{retries}, package_id: #{id}, #{e}")
retry
end
end
# NOTE: Its important that this job run in queue 'default' in order to avoid concurrency
PackageUpdateIfDirtyJob.perform_later(id)
end
end

Expand Down

0 comments on commit 4c8b5f9

Please sign in to comment.