job_hunter 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +2 -0
- data/job_hunter.gemspec +1 -1
- data/lib/job_hunter/dj_wrappers.rb +5 -4
- data/lib/job_hunter/version.rb +1 -1
- data/spec/job_hunter_spec.rb +5 -0
- 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: b742f06915ea138b739dd47115c9b37749004c04
|
4
|
+
data.tar.gz: eef0c4781b20c5e6439ce55f05b7f255c93e629a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f61221e0d4dd9879d366060559472fd12bb0235d950fd139984d966c6b461e68fd6578ecfddbbecb354e77e63c2653c6526dc605b80a771180a7de2436903dc
|
7
|
+
data.tar.gz: da5e57f46bd755316ef41c121eb88ed0cbcd48c2abad389cb605fe3b4217d1bb2dbef7b786346cbe377e8160c523490f684311d6f93c33b44b40a6196b4fdead
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -51,6 +51,8 @@ Adding an index to `handler` in the `delayed_jobs` table is recommended if you p
|
|
51
51
|
|
52
52
|
All of these methods will return a `Delayed::Job` if they find, create, or destroy a job and `nil` otherwise.
|
53
53
|
|
54
|
+
`find` will not return failed jobs (all attempts exhausted). `find_or_create` will likewise create a new job if there is an identical failed job.
|
55
|
+
|
54
56
|
The `create` and `find_or_create` methods accept the same options hash as `Delayed::Job.enqueue`. Options passed in to these methods (`run_at`, `queue`, and `priority`) will override the defauls set in your custom job class. Options passed in to `find_or_create` will not affect a job already enqueued.
|
55
57
|
|
56
58
|
These class methods have corresponding instance methods:
|
data/job_hunter.gemspec
CHANGED
@@ -7,7 +7,7 @@ require 'job_hunter/version'
|
|
7
7
|
Gem::Specification.new do |gem|
|
8
8
|
gem.name = 'job_hunter'
|
9
9
|
gem.version = JobHunter::VERSION
|
10
|
-
gem.date = '2014-05-
|
10
|
+
gem.date = '2014-05-13'
|
11
11
|
gem.authors = ['Ryan Moser']
|
12
12
|
gem.email = 'ryanpmoser@gmail.com'
|
13
13
|
gem.homepage = 'https://github.com/moserrya/job_hunter'
|
@@ -22,14 +22,15 @@ module JobHunter
|
|
22
22
|
def new_with_options(*args)
|
23
23
|
options = args.extract_options!
|
24
24
|
job = new(*args)
|
25
|
-
job.define_singleton_method
|
26
|
-
|
25
|
+
job.define_singleton_method(:_options_) do
|
26
|
+
self.class._defaults_.merge(options)
|
27
|
+
end
|
27
28
|
job
|
28
29
|
end
|
29
30
|
|
30
31
|
module InstanceMethods
|
31
32
|
def find
|
32
|
-
Delayed::Job.where(handler: to_yaml).first
|
33
|
+
Delayed::Job.where(handler: to_yaml, failed_at: nil).first
|
33
34
|
end
|
34
35
|
|
35
36
|
def create
|
@@ -37,7 +38,7 @@ module JobHunter
|
|
37
38
|
end
|
38
39
|
|
39
40
|
def find_or_create
|
40
|
-
find
|
41
|
+
find or create
|
41
42
|
end
|
42
43
|
|
43
44
|
def destroy
|
data/lib/job_hunter/version.rb
CHANGED
data/spec/job_hunter_spec.rb
CHANGED
@@ -46,6 +46,11 @@ describe JobHunter do
|
|
46
46
|
it 'finds the job given the same arguments' do
|
47
47
|
expect(KustomJob.find(model_id, details)).to eq(@job)
|
48
48
|
end
|
49
|
+
|
50
|
+
it 'does not find failed jobs' do
|
51
|
+
@job.touch(:failed_at)
|
52
|
+
expect(KustomJob.find(model_id, details)).to be_nil
|
53
|
+
end
|
49
54
|
end
|
50
55
|
|
51
56
|
context '.find_or_create' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: job_hunter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Moser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: delayed_job_active_record
|