chore: Add delay before running dataimport job (#8039)
- We have observed some failures for data import jobs in the cloud due to race conditions with job executions and active storage file uploading. This PR adds delays and retries to accommodate that.
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
class DataImportJob < ApplicationJob
|
||||
queue_as :low
|
||||
retry_on ActiveStorage::FileNotFoundError, wait: 1.minute, attempts: 3
|
||||
|
||||
def perform(data_import)
|
||||
@data_import = data_import
|
||||
|
||||
@@ -29,6 +29,7 @@ class DataImport < ApplicationRecord
|
||||
private
|
||||
|
||||
def process_data_import
|
||||
DataImportJob.perform_later(self)
|
||||
# we wait for the file to be uploaded to the cloud
|
||||
DataImportJob.set(wait: 1.minute).perform_later(self)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user