Merge pull request #8603 from colinux/fix-export-race-condition

fix(export/job): race condition when export was already generated
This commit is contained in:
Colin Darie 2023-02-09 11:15:40 +01:00 committed by GitHub
commit 24f9058889
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View file

@ -3,7 +3,13 @@ class ExportJob < ApplicationJob
discard_on ActiveRecord::RecordNotFound
before_perform do |job|
Sentry.set_tags(procedure_id: job.arguments.first.procedure.id)
end
def perform(export)
return if export.generated?
export.compute_with_safe_stale_for_purge do
export.compute
end

View file

@ -163,6 +163,10 @@ class Export < ApplicationRecord
end
end
def procedure
groupe_instructeurs.first.procedure
end
private
def load_snapshot!
@ -204,8 +208,4 @@ class Export < ApplicationRecord
service.to_geo_json
end
end
def procedure
groupe_instructeurs.first.procedure
end
end