scheduled_job 0.2.3 → 0.2.4
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 +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/scheduled_job/version.rb +1 -1
- data/lib/scheduled_job.rb +8 -3
- data/spec/lib/scheduled_job_spec.rb +10 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30677ced04a460d65fe090c92f6bf5b914d85d07
|
4
|
+
data.tar.gz: 8d5ecd3dbc01fcc33c52663d24123943192998a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 746edac4b4b6c72f2281f7fe7fcc6d86d383867e398f43c54b03f0f92712cd4f0b907237dfae32d94157c8490bc276271ead90bae7d663a07e446561817028f2
|
7
|
+
data.tar.gz: 3ab1ba959f72642680b83b7c80b4e061a9f94efe38f445596789461a2a1523083b56d7a6267b4f8b7099c13fc079238cb3d7e7a481c9fb2703e684d6b069ddac
|
data/CHANGELOG.md
CHANGED
@@ -35,3 +35,6 @@ This is needed is some cases where scheduled_job is deployed in a container and
|
|
35
35
|
|
36
36
|
# 0.2.3
|
37
37
|
Updating the acitve* gem dependency versions to support the current release. Also drops travis testing for ruby 1.9.3 which is no longer an officially supported Ruby version.
|
38
|
+
|
39
|
+
# 0.2.4
|
40
|
+
Updates the way that we detect if an instance of a job has already been scheduled. This was because we were incorrectly seeing a delayed method as an instance of that job already being scheduled.
|
data/lib/scheduled_job.rb
CHANGED
@@ -97,12 +97,17 @@ module ScheduledJob
|
|
97
97
|
end
|
98
98
|
|
99
99
|
def can_schedule_job?(job = nil)
|
100
|
-
conditions =
|
100
|
+
conditions = 'failed_at IS NULL'
|
101
101
|
unless job.blank?
|
102
|
-
conditions
|
102
|
+
conditions << " AND id != "
|
103
103
|
conditions << job.id
|
104
104
|
end
|
105
|
-
|
105
|
+
jobs = Delayed::Job.where(conditions).find_all do |dj|
|
106
|
+
dj.handler.split[1][/(?<=:)[A-Z][A-z0-9:]+/] == self.name
|
107
|
+
end
|
108
|
+
|
109
|
+
job_count = jobs.count
|
110
|
+
|
106
111
|
intended_job_count = 1
|
107
112
|
|
108
113
|
if ScheduledJob.config.jobs && ScheduledJob.config.jobs[self.name]
|
@@ -20,7 +20,10 @@ class Test < UnderTest
|
|
20
20
|
end
|
21
21
|
|
22
22
|
describe ScheduledJob do
|
23
|
-
before
|
23
|
+
before do
|
24
|
+
ScheduledJob.configure { |config| config.jobs = nil }
|
25
|
+
Delayed::Job.delete_all
|
26
|
+
end
|
24
27
|
|
25
28
|
let(:under_test) { UnderTest.new }
|
26
29
|
|
@@ -195,6 +198,12 @@ describe ScheduledJob do
|
|
195
198
|
UnderTest.schedule_job job
|
196
199
|
end
|
197
200
|
|
201
|
+
it 'doesnt find delayed methods as existing' do
|
202
|
+
UnderTest.delay.queue_name
|
203
|
+
UnderTest.schedule_job
|
204
|
+
expect(Delayed::Job.count).to eq(2)
|
205
|
+
end
|
206
|
+
|
198
207
|
it 'doesnt find substring jobs as existing' do
|
199
208
|
UnderTest.schedule_job
|
200
209
|
Test.schedule_job
|
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
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- CallumD
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2016-
|
14
|
+
date: 2016-07-18 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: delayed_job
|