canvas_sync 0.17.4 → 0.17.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/canvas_sync/job_batches/batch.rb +39 -1
- data/lib/canvas_sync/job_batches/batch_aware_job.rb +1 -1
- data/lib/canvas_sync/job_batches/callback.rb +2 -1
- data/lib/canvas_sync/job_batches/pool.rb +31 -1
- data/lib/canvas_sync/job_batches/sidekiq.rb +3 -2
- data/lib/canvas_sync/version.rb +1 -1
- data/spec/dummy/log/test.log +11301 -0
- data/spec/job_batching/batch_spec.rb +28 -0
- metadata +2 -2
@@ -227,6 +227,34 @@ RSpec.describe CanvasSync::JobBatches::Batch do
|
|
227
227
|
end
|
228
228
|
end
|
229
229
|
|
230
|
+
it 'delays triggering callbacks if keep_open is set' do
|
231
|
+
ActiveJob::Base.queue_adapter = :sidekiq
|
232
|
+
CanvasSync::JobBatches::Batch::Callback.worker_class = CanvasSync::JobBatches::Sidekiq::SidekiqCallbackWorker
|
233
|
+
|
234
|
+
callback_instance = double('SampleCallback')
|
235
|
+
expect(SampleCallback).to receive(:new).at_least(1).times.and_return(callback_instance)
|
236
|
+
expect(callback_instance).not_to receive(:on_complete)
|
237
|
+
expect(callback_instance).not_to receive(:on_success)
|
238
|
+
|
239
|
+
batch.on(:complete, SampleCallback)
|
240
|
+
batch.on(:success, SampleCallback)
|
241
|
+
batch.keep_open!
|
242
|
+
|
243
|
+
Sidekiq::Testing.inline! do
|
244
|
+
CanvasSync::JobBatches::Batch.process_failed_job(bid, jid)
|
245
|
+
CanvasSync::JobBatches::Batch.process_successful_job(bid, jid)
|
246
|
+
end
|
247
|
+
|
248
|
+
RSpec::Mocks.space.proxy_for(callback_instance).reset
|
249
|
+
|
250
|
+
expect(callback_instance).to receive(:on_complete)
|
251
|
+
expect(callback_instance).to receive(:on_success)
|
252
|
+
|
253
|
+
Sidekiq::Testing.inline! do
|
254
|
+
batch.let_close!
|
255
|
+
end
|
256
|
+
end
|
257
|
+
|
230
258
|
it 'triggers callbacks as expected' do
|
231
259
|
ActiveJob::Base.queue_adapter = :sidekiq
|
232
260
|
CanvasSync::JobBatches::Batch.redis { |r| r.hset("BID-#{bid}", 'pending', 0) }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: canvas_sync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.17.
|
4
|
+
version: 0.17.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nate Collings
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|