fix(imports): check run ownership before heartbeat
This commit is contained in:
@@ -190,8 +190,8 @@ class DataImports::Intercom::Importer
|
||||
end
|
||||
|
||||
def continue_import_with_heartbeat?
|
||||
return true if @data_import.updated_at > HEARTBEAT_INTERVAL.ago
|
||||
return false if import_stopped?
|
||||
return true if @data_import.updated_at > HEARTBEAT_INTERVAL.ago
|
||||
|
||||
@data_import.touch if @data_import.updated_at <= HEARTBEAT_INTERVAL.ago
|
||||
true
|
||||
|
||||
@@ -315,8 +315,7 @@ RSpec.describe DataImports::Intercom::Importer do
|
||||
allow(data_import).to receive(:touch).and_call_original
|
||||
importer = described_class.new(data_import: data_import, run_id: run_id)
|
||||
allow(importer).to receive(:create_message) do
|
||||
data_import.update!(source_metadata: { DataImport::ACTIVE_INTERCOM_IMPORT_RUN_ID_KEY => 'new-run' })
|
||||
travel 1.minute
|
||||
DataImport.find(data_import.id).update!(source_metadata: { DataImport::ACTIVE_INTERCOM_IMPORT_RUN_ID_KEY => 'new-run' })
|
||||
end
|
||||
|
||||
importer.import_conversations_page
|
||||
|
||||
Reference in New Issue
Block a user