sqeduler 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: abf3832836e43f9513299831abcce9bc67551ed1
4
- data.tar.gz: eee3fc43d7e4d7aa106e7ff244f8029932feda94
3
+ metadata.gz: 285c8e84ead9c7c09c993c9dd758dde10dd1e9f1
4
+ data.tar.gz: 3fa620e267de5111437ed61a7993ea9e6ce9f248
5
5
  SHA512:
6
- metadata.gz: e984434cc1cd0c5fbe44f34b85a1fa75d520d2de2e635a0ba3e848ad195dcc6015e0cf00495e2cc41fe30fdfcb3988cbf2e7aac7a5c24d547f6c6a95dc3d998d
7
- data.tar.gz: c5cc39b2699fb6da450f3c8dd32c4da5eadd11775820b3420af024d1376598ca51f09a4fae376b60ef6761cb75fe3323a411ecebfcf7ef0a51b4df7cf582e9a8
6
+ metadata.gz: 18bed5ddc6ea2b8f34a5dd5817c49c9841912307a0dfe4e864dfae796e561a4e5e571132a20f4344ac8c049164795aa601b76dfe81232486c6801137d5a65825
7
+ data.tar.gz: 1fcfd239f05867d25212d83ba47c0fb28794d28799ffed3b7c4dafecca225af13c48373f321ad536424b1f73b45d69ed2609764bf9020b8f438ec5385c7e0558
data/CHANGES.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### 0.3.3 / 2016-03-25
2
+
3
+ * Fixed lock refresher not calling `redis_pool` properly so it wouldn't actually run
4
+
1
5
  ### 0.3.2 / 2016-03-10
2
6
 
3
7
  * Fixed lock refresher failing to lock properly for exclusive runs
@@ -39,7 +39,7 @@ module Sqeduler
39
39
  def synchronize
40
40
  now = Time.now.to_i
41
41
 
42
- Service.redis_pool do |redis|
42
+ Service.redis_pool.with do |redis|
43
43
  redis.pipelined do
44
44
  workers.each do |_worker, _tid, args|
45
45
  # No sense in pinging if it's not been running long enough to matter
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Sqeduler
3
- VERSION = "0.3.2".freeze
3
+ VERSION = "0.3.3".freeze
4
4
  end
@@ -58,6 +58,8 @@ RSpec.describe Sqeduler::LockMaintainer do
58
58
 
59
59
  run.join(1)
60
60
  run.terminate
61
+
62
+ expect(instance.send(:redis_lock).locked?).to eq(false)
61
63
  end
62
64
 
63
65
  it "doesn't die on errors" do
@@ -67,6 +69,16 @@ RSpec.describe Sqeduler::LockMaintainer do
67
69
  expect(run.status).to_not be_falsy
68
70
  run.terminate
69
71
  end
72
+
73
+ it "obeys the exclusive lock" do
74
+ lock = Sqeduler::RedisLock.new("sqeduler-lock-maintainer", :expiration => 60, :timeout => 0)
75
+ lock.lock
76
+
77
+ expect(instance).to_not receive(:synchronize)
78
+
79
+ run.join(1)
80
+ run.terminate
81
+ end
70
82
  end
71
83
 
72
84
  context "#synchronize" do
@@ -121,13 +133,13 @@ RSpec.describe Sqeduler::LockMaintainer do
121
133
  end
122
134
 
123
135
  context "when outside the run threshold" do
124
- let(:run_at) { Time.now - described_class::RUN_INTERVAL - 5 }
136
+ let(:run_at) { (Time.now - described_class::RUN_INTERVAL - 5).to_i }
125
137
 
126
138
  let(:lock_key) { SyncExclusiveWorker.sync_lock_key(job_args) }
127
139
 
128
140
  it "refresh the lock" do
129
141
  SyncExclusiveWorker.new.perform(job_args) do
130
- Sqeduler::Service.redis_pool do |redis|
142
+ Sqeduler::Service.redis_pool.with do |redis|
131
143
  # Change the lock timing to make sure ours works
132
144
  redis.expire(lock_key, 10)
133
145
  expect(redis.ttl(lock_key)).to eq(10)
@@ -141,17 +153,10 @@ RSpec.describe Sqeduler::LockMaintainer do
141
153
  end
142
154
 
143
155
  # Shouldn't be around once the job finished
144
- Sqeduler::Service.redis_pool do |redis|
156
+ Sqeduler::Service.redis_pool.with do |redis|
145
157
  expect(redis.exists(lock_key)).to eq(false)
146
158
  end
147
159
  end
148
-
149
- it "obeys the exclusive lock" do
150
- instance.send(:redis_lock).send(:take_lock)
151
- expect(instance).to_not receive(:str_to_class)
152
-
153
- sync
154
- end
155
160
  end
156
161
  end
157
162
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sqeduler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jared Jenkins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-10 00:00:00.000000000 Z
11
+ date: 2016-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sidekiq