Commit 8e3d3297 authored by Pavel Shutsin's avatar Pavel Shutsin

Update snapshot worker arguments

parent 0224e857
......@@ -20,7 +20,7 @@ module Analytics
segment.assign_attributes(attributes)
if segment.save
Analytics::DevopsAdoption::CreateSnapshotWorker.perform_async(segment.id, nil)
Analytics::DevopsAdoption::CreateSnapshotWorker.perform_async(segment.id)
ServiceResponse.success(payload: response_payload)
else
......
......@@ -16,7 +16,7 @@ module Analytics
# rubocop: disable CodeReuse/ActiveRecord
def perform
::Analytics::DevopsAdoption::Segment.all.pluck(:id).each.with_index do |segment_id, i|
CreateSnapshotWorker.perform_in(i * WORKERS_GAP, segment_id, nil)
CreateSnapshotWorker.perform_in(i * WORKERS_GAP, segment_id)
end
end
# rubocop: enable CodeReuse/ActiveRecord
......
......@@ -28,7 +28,7 @@ RSpec.describe Analytics::DevopsAdoption::Segments::CreateService do
subject
expect(Analytics::DevopsAdoption::CreateSnapshotWorker).to have_received(:perform_async).with(Analytics::DevopsAdoption::Segment.last.id, nil)
expect(Analytics::DevopsAdoption::CreateSnapshotWorker).to have_received(:perform_async).with(Analytics::DevopsAdoption::Segment.last.id)
end
context 'when user is not an admin' do
......
......@@ -11,8 +11,8 @@ RSpec.describe Analytics::DevopsAdoption::CreateAllSnapshotsWorker do
it 'schedules workers for each individual segment' do
freeze_time do
expect(Analytics::DevopsAdoption::CreateSnapshotWorker).to receive(:perform_in).with(0, segment1.id, nil)
expect(Analytics::DevopsAdoption::CreateSnapshotWorker).to receive(:perform_in).with(5, segment2.id, nil)
expect(Analytics::DevopsAdoption::CreateSnapshotWorker).to receive(:perform_in).with(0, segment1.id)
expect(Analytics::DevopsAdoption::CreateSnapshotWorker).to receive(:perform_in).with(5, segment2.id)
worker.perform
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment