resque-lonely_job 1.0.1 → 1.0.2

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: 77d6fb9e55406f71e625a51f3aed732858c53c30
4
- data.tar.gz: 5428f1070c91a492eefd4b13eaf9ba9bb4d404fa
3
+ metadata.gz: 83362de6a98d68ae3f20fd8e7cd0cb11fff06be7
4
+ data.tar.gz: 829b8cc700dbfda2772cd3c15f3df8ab1fd7deed
5
5
  SHA512:
6
- metadata.gz: 5014e12936d857fec3009b2c8b017689a4c3e25765f3122a196d984d3fbc9fa07c1cf4591de26d5801716104b67b6948d08fdc59e52a8fb5aff73e91970b24b0
7
- data.tar.gz: 57fbd6bcb2a2189bc382814751f29efd4b14071e059a4e50087a0c5e6e8ad8f7109d640ce0755bfd48566d7df40646430c2fdfc2415f83378d4615e7a2309ef1
6
+ metadata.gz: b9bfed33191b4010235ca4eec4b141a33b5cdfd81162823b46b044de4bfe13a9b469e85b1904f836d95ddd5b6ee65831297e18ede0281af896d5122402f1d52c
7
+ data.tar.gz: 9d38553d777a2a8fe93b2f421f2cd21dfcd56dd0ed8c8a04cd1357d983aa2c85a7468347f955db00f761a5cbda9c1241302631b61a5eb8768083c724e7ac2a5d
data/README.md CHANGED
@@ -12,14 +12,19 @@ Requires a version of MRI Ruby >= 1.9.3.
12
12
  Ensures that for a given queue, only one worker is working on a job at any given
13
13
  time.
14
14
 
15
- This differs from [resque-queue-lock](https://github.com/mashion/resque-queue-lock), [resque-lock](https://github.com/defunkt/resque-lock) and
15
+ Resque::LonelyJob differs from [resque-queue-lock](https://github.com/mashion/resque-queue-lock), [resque-lock](https://github.com/defunkt/resque-lock) and
16
16
  [resque-loner](http://github.com/jayniz/resque-loner) in that the same job may
17
17
  be queued multiple times but you're guaranteed that first job queued will run to
18
18
  completion before subsequent jobs are run.
19
19
 
20
- However, it is possible that subsequent jobs are re-ordered depending upon
21
- worker behavior. Therefore it is recommended that the payload for jobs be
22
- stored in a separate redis list distinct from the Resque queue (see Example #3).
20
+ However, it is a very *strong* possibility that subsequent jobs are re-ordered due to
21
+ the implementation of
22
+ [reenqueue](https://github.com/wallace/resque-lonely_job/blob/master/lib/resque-lonely_job.rb#L35).
23
+ (See Example #2 for an alternative approach that attempts to preserve job
24
+ ordering but introduces the possibility of starvation.)
25
+
26
+ Therefore it is recommended that the payload for jobs be stored in a separate
27
+ redis list distinct from the Resque queue (see Example #3).
23
28
 
24
29
  ## Installation
25
30
 
@@ -73,7 +78,8 @@ method.
73
78
  end
74
79
 
75
80
  # Overwrite reenqueue to lpush instead of default rpush. This attempts to
76
- # preserve job ordering but job order is *NOT* guaranteed.
81
+ # preserve job ordering but job order is *NOT* guaranteed and also not
82
+ # likely. See the comment on SHA: e9912fb2 for why.
77
83
  def self.reenqueue(*args)
78
84
  Resque.redis.lpush("queue:#{Resque.queue_from_class(self)}", Resque.encode(class: self, args: args))
79
85
  end
@@ -147,8 +153,6 @@ It now doesn't matter whether job 1 and job 2 are re-ordered as whichever goes
147
153
  first will perform an atomic pop on the redis list that contains the data needed
148
154
  for its job (data x, data y, data z).
149
155
 
150
- *NOTE*: Worker starvation and fairness is still possible as in Example 2.
151
-
152
156
  ## Contributing
153
157
 
154
158
  1. Fork it
@@ -31,10 +31,6 @@ module Resque
31
31
  Resque.redis.del(redis_key(*args))
32
32
  end
33
33
 
34
- # Unfortunately, there's not a Resque interface for lpush so we have to
35
- # role our own. This is based on Resque.push but we don't need to
36
- # call Resque.watch_queue as the queue should already exist if we're
37
- # unable to get the lock.
38
34
  def reenqueue(*args)
39
35
  Resque.enqueue(self, *args)
40
36
  end
@@ -1,7 +1,7 @@
1
1
  module Resque
2
2
  module Plugins
3
3
  module LonelyJob
4
- VERSION = "1.0.1"
4
+ VERSION = "1.0.2"
5
5
  end
6
6
  end
7
7
  end
@@ -13,6 +13,7 @@ Gem::Specification.new do |gem|
13
13
  gem.name = "resque-lonely_job"
14
14
  gem.require_paths = ["lib"]
15
15
  gem.version = Resque::Plugins::LonelyJob::VERSION
16
+ gem.license = "MIT"
16
17
 
17
18
  gem.add_dependency 'resque', '>= 1.2'
18
19
  gem.add_development_dependency 'mock_redis'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque-lonely_job
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan R. Wallace
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-05 00:00:00.000000000 Z
11
+ date: 2014-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: resque
@@ -115,7 +115,8 @@ files:
115
115
  - spec/lib/lonely_job_spec.rb
116
116
  - spec/spec_helper.rb
117
117
  homepage: http://github.com/wallace/resque-lonely_job
118
- licenses: []
118
+ licenses:
119
+ - MIT
119
120
  metadata: {}
120
121
  post_install_message:
121
122
  rdoc_options: []