canvas_sync 0.17.23.beta6 → 0.17.24
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 +99 -58
- data/lib/canvas_sync/job_batches/batch_aware_job.rb +7 -7
- data/lib/canvas_sync/job_batches/pool.rb +42 -52
- data/lib/canvas_sync/job_batches/sidekiq.rb +7 -7
- data/lib/canvas_sync/jobs/sync_terms_job.rb +1 -1
- data/lib/canvas_sync/version.rb +1 -1
- data/spec/dummy/log/development.log +540 -0
- data/spec/dummy/log/test.log +43585 -0
- data/spec/job_batching/batch_aware_job_spec.rb +3 -3
- data/spec/job_batching/batch_spec.rb +40 -1
- data/spec/job_batching/sidekiq_spec.rb +2 -2
- metadata +4 -4
@@ -66,10 +66,10 @@ RSpec.describe CanvasSync::JobBatches::BatchAwareJob do
|
|
66
66
|
let(:bid) { 'SAMPLEBID' }
|
67
67
|
|
68
68
|
before do
|
69
|
-
Thread.current[
|
70
|
-
Thread.current[
|
69
|
+
Thread.current[CanvasSync::JobBatches::CURRENT_BATCH_THREAD_KEY] = CanvasSync::JobBatches::Batch.new(bid)
|
70
|
+
Thread.current[CanvasSync::JobBatches::CURRENT_BATCH_THREAD_KEY].instance_variable_set(:@open, true)
|
71
71
|
end
|
72
|
-
after { Thread.current[
|
72
|
+
after { Thread.current[CanvasSync::JobBatches::CURRENT_BATCH_THREAD_KEY] = nil }
|
73
73
|
|
74
74
|
it 'yields' do
|
75
75
|
expect {
|
@@ -70,7 +70,7 @@ RSpec.describe CanvasSync::JobBatches::Batch do
|
|
70
70
|
it 'sets Thread.current bid' do
|
71
71
|
batch = CanvasSync::JobBatches::Batch.new
|
72
72
|
batch.jobs do
|
73
|
-
expect(Thread.current[
|
73
|
+
expect(Thread.current[CanvasSync::JobBatches::CURRENT_BATCH_THREAD_KEY]).to eq(batch)
|
74
74
|
end
|
75
75
|
end
|
76
76
|
end
|
@@ -453,4 +453,43 @@ RSpec.describe CanvasSync::JobBatches::Batch do
|
|
453
453
|
end
|
454
454
|
end
|
455
455
|
end
|
456
|
+
|
457
|
+
describe '.redis' do
|
458
|
+
it 'returns the same connection if called when nested' do
|
459
|
+
CanvasSync::JobBatches::Batch.redis do |r1|
|
460
|
+
CanvasSync::JobBatches::Batch.redis do |r2|
|
461
|
+
expect(r1).to be r2
|
462
|
+
end
|
463
|
+
end
|
464
|
+
end
|
465
|
+
|
466
|
+
it 'returns a RedisProxy object if no block is given' do
|
467
|
+
expect(CanvasSync::JobBatches::Batch.redis).to be_a(CanvasSync::JobBatches::Batch::RedisProxy)
|
468
|
+
end
|
469
|
+
|
470
|
+
describe 'RedisProxy' do
|
471
|
+
let!(:proxy) { CanvasSync::JobBatches::Batch.redis }
|
472
|
+
|
473
|
+
it 'calls Batch.redis with a block' do
|
474
|
+
expect(CanvasSync::JobBatches::Batch).to receive(:redis) do |&block|
|
475
|
+
expect(block).to be_a Proc
|
476
|
+
end
|
477
|
+
proxy.sadd('KEY', 5)
|
478
|
+
end
|
479
|
+
|
480
|
+
describe '#multi' do
|
481
|
+
it 'works with 1 arity' do
|
482
|
+
proxy.multi do |r|
|
483
|
+
r.sadd('KEY', 5)
|
484
|
+
end
|
485
|
+
end
|
486
|
+
|
487
|
+
it 'works with 0 arity' do
|
488
|
+
proxy.multi do
|
489
|
+
proxy.sadd('KEY', 5)
|
490
|
+
end
|
491
|
+
end
|
492
|
+
end
|
493
|
+
end
|
494
|
+
end
|
456
495
|
end
|
@@ -57,8 +57,8 @@ RSpec.describe CanvasSync::JobBatches::Sidekiq do
|
|
57
57
|
context 'when in batch' do
|
58
58
|
let(:bid) { 'SAMPLEBID' }
|
59
59
|
let(:jid) { 'SAMPLEJID' }
|
60
|
-
before { Thread.current[
|
61
|
-
after { Thread.current[
|
60
|
+
before { Thread.current[CanvasSync::JobBatches::CURRENT_BATCH_THREAD_KEY] = CanvasSync::JobBatches::Batch.new(bid) }
|
61
|
+
after { Thread.current[CanvasSync::JobBatches::CURRENT_BATCH_THREAD_KEY] = nil }
|
62
62
|
|
63
63
|
it 'yields' do
|
64
64
|
yielded = false
|
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.24
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nate Collings
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -683,9 +683,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
683
683
|
version: '0'
|
684
684
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
685
685
|
requirements:
|
686
|
-
- - "
|
686
|
+
- - ">="
|
687
687
|
- !ruby/object:Gem::Version
|
688
|
-
version:
|
688
|
+
version: '0'
|
689
689
|
requirements: []
|
690
690
|
rubygems_version: 3.0.3
|
691
691
|
signing_key:
|