scheduled_job 0.2.4 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 30677ced04a460d65fe090c92f6bf5b914d85d07
4
- data.tar.gz: 8d5ecd3dbc01fcc33c52663d24123943192998a2
3
+ metadata.gz: e74d081e54d0af0a05929b690768698275473078
4
+ data.tar.gz: e4a12cc9089271971a3359a21cb056cc51c8e8fc
5
5
  SHA512:
6
- metadata.gz: 746edac4b4b6c72f2281f7fe7fcc6d86d383867e398f43c54b03f0f92712cd4f0b907237dfae32d94157c8490bc276271ead90bae7d663a07e446561817028f2
7
- data.tar.gz: 3ab1ba959f72642680b83b7c80b4e061a9f94efe38f445596789461a2a1523083b56d7a6267b4f8b7099c13fc079238cb3d7e7a481c9fb2703e684d6b069ddac
6
+ metadata.gz: f8a132116ecb9bf0a9be607a99a548abcea5e968579fc0ea0da10c61c5ab8913e5c06d390be4843aa205abd684b91fe822c21a6c3d61f9243ee3a436ee61b0db
7
+ data.tar.gz: eb0a87986ee873ce1aafc619f66a23a52af25e0e62f0b77040ea243b93a1426f37ea369a07fb951e51461e63d02f8dc2d4c1b380d1ae1519267f9119735b3efb
@@ -98,10 +98,8 @@ module ScheduledJob
98
98
 
99
99
  def can_schedule_job?(job = nil)
100
100
  conditions = 'failed_at IS NULL'
101
- unless job.blank?
102
- conditions << " AND id != "
103
- conditions << job.id
104
- end
101
+ conditions << " AND id != #{job.id}" unless job.blank?
102
+
105
103
  jobs = Delayed::Job.where(conditions).find_all do |dj|
106
104
  dj.handler.split[1][/(?<=:)[A-Z][A-z0-9:]+/] == self.name
107
105
  end
@@ -16,6 +16,12 @@ class UnderTest
16
16
  end
17
17
  end
18
18
 
19
+ class Job
20
+ def id
21
+ 12
22
+ end
23
+ end
24
+
19
25
  class Test < UnderTest
20
26
  end
21
27
 
@@ -220,6 +226,10 @@ describe ScheduledJob do
220
226
  under_test.failure(dummy_job)
221
227
  end
222
228
 
229
+ it "can scheduled additional instances of a given job" do
230
+ expect { UnderTest.schedule_job(Job.new) }.not_to raise_error
231
+ end
232
+
223
233
  describe '#random_minutes' do
224
234
  it 'returns a random number with a base and delta' do
225
235
  expect(UnderTest.random_minutes(60, 10)).to be_within(10 * 60).of(60 * 60)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scheduled_job
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - CallumD