resque-waiting-room 0.2.3 → 0.3.0

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: fc9d18de0b400796244ec7bbcd217f6863e0d7f0
4
- data.tar.gz: 6a0aea7bfb129b4727b9f7fd6a2b3117d77418c7
3
+ metadata.gz: ee4bf23cad9fb42befe7e128de9a876a985db041
4
+ data.tar.gz: 6bce8e148ed490c2fc31a4939eda93d231b3ec6d
5
5
  SHA512:
6
- metadata.gz: a2c8d82aba863078f20afdd7360bd43d47487975cd40d4a638db36defca78f710690331c0a5947d6365adcf1a56beaa90868aacead0c870aafcfc63eea8523cf
7
- data.tar.gz: 69c19f6be8c9f303e5e6243721691b55d0fb347b3785c18a58bc6ae6d6130b4a7ad741de861e838b98282c9625118b3c17ff6076ce7491d7e53933517f7bd3be
6
+ metadata.gz: 050bde21ca53609034825bb2e4198cbf4d4939f0065277dc902a8518ad7780604d59686490944d00c75b588a34133aec84dc762823d48bdc5e18bc0a4a084f62
7
+ data.tar.gz: 6750e5a4995fe7a37df564525c3d3f4c0831804abb1037a614af8c0581e4496feea2452a9041ef24aceb1f7de9639f68db73f953041a1ecee19494abbda2e699
@@ -1 +1 @@
1
- 2.1.4
1
+ 2.4.3
@@ -1,7 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
- - "1.9.2"
4
- - "1.9.3"
5
3
  - "2.0.0"
4
+ - "2.1.0"
5
+ - "2.2.4"
6
+ - "2.4.0"
6
7
  - jruby-19mode # JRuby in 1.9 mode
7
- - rbx-19mode
data/Gemfile CHANGED
@@ -4,7 +4,7 @@ source "https://rubygems.org"
4
4
  gemspec
5
5
 
6
6
  group :development do
7
- gem 'resque', '~>1.24.1'
7
+ gem 'resque', '~>1.26.0'
8
8
  end
9
9
 
10
10
  group :test do
@@ -74,6 +74,7 @@ Run tests with the following command
74
74
  - Max Dunn [@maxdunn210](https://github.com/maxdunn210) for making me switch Resque 2 specific code in it's own branch
75
75
  - Jeff Durand [@johnnyiller](https://github.com/johnnyiller) for the update of has_remaining_performs_key using the latest form set and the fix for a rare ttl bug
76
76
  - Tatsuya Takamura [@ttakamura](https://github.com/ttakamura) for raising the issue on the rare ttl bug
77
+ - Omry Zobel [@omryYotpo](https://github.com/omryYotpo) for allowing some customization of the redis key
77
78
 
78
79
  [rq]: http://github.com/resque/resque
79
80
 
@@ -1,7 +1,7 @@
1
1
  module Resque
2
2
  module Plugins
3
3
  module WaitingRoom
4
- VERSION = '0.2.3'
4
+ VERSION = '0.3.0'
5
5
  end
6
6
  end
7
7
  end
@@ -4,18 +4,18 @@ module Resque
4
4
  class MissingParams < RuntimeError; end
5
5
 
6
6
  def can_be_performed(params)
7
- raise MissingParams unless params.is_a?(Hash) && params.keys.sort == [:period, :times]
7
+ raise MissingParams unless params.is_a?(Hash) && params.keys.sort == %i[period times]
8
8
 
9
9
  @period ||= params[:period]
10
10
  @max_performs ||= params[:times].to_i
11
11
  end
12
12
 
13
- def waiting_room_redis_key
13
+ def waiting_room_redis_key(*_args)
14
14
  [self.to_s, 'remaining_performs'].compact.join(':')
15
15
  end
16
16
 
17
17
  def before_perform_waiting_room(*args)
18
- key = waiting_room_redis_key
18
+ key = waiting_room_redis_key(args)
19
19
  return unless remaining_performs_key?(key)
20
20
 
21
21
  performs_left = Resque.redis.decrby(key, 1).to_i
@@ -40,7 +40,7 @@ module Resque
40
40
  end
41
41
 
42
42
  def repush(*args)
43
- key = waiting_room_redis_key
43
+ key = waiting_room_redis_key(args)
44
44
  value = Resque.redis.get(key)
45
45
  no_performs_left = value && value != '' && value.to_i <= 0
46
46
  Resque.push 'waiting_room', class: self.to_s, args: args if no_performs_left
@@ -1,23 +1,24 @@
1
1
  # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib/resque/plugins", __FILE__)
3
- require "version"
2
+
3
+ $LOAD_PATH.push File.expand_path('../lib/resque/plugins', __FILE__)
4
+ require 'version'
4
5
 
5
6
  Gem::Specification.new do |s|
6
- s.name = "resque-waiting-room"
7
+ s.name = 'resque-waiting-room'
7
8
  s.version = Resque::Plugins::WaitingRoom::VERSION
8
- s.authors = ["Julien Blanchard"]
9
- s.email = ["julien@sideburns.eu"]
10
- s.homepage = "https://www.github.com/julienXX/resque-waiting-room"
11
- s.summary = %q{Put your Resque jobs in a waiting room}
12
- s.description = %q{Throttle your Resque jobs}
9
+ s.authors = ['Julien Blanchard']
10
+ s.email = ['julien@sideburns.eu']
11
+ s.homepage = 'https://www.github.com/julienXX/resque-waiting-room'
12
+ s.summary = 'Put your Resque jobs in a waiting room'
13
+ s.description = 'Throttle your Resque jobs'
13
14
 
14
- s.rubyforge_project = "resque-waiting-room"
15
+ s.rubyforge_project = 'resque-waiting-room'
15
16
 
16
17
  s.files = `git ls-files`.split("\n")
17
18
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
- s.files += Dir.glob("lib/**/*")
20
- s.files += Dir.glob("spec/**/*")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
20
+ s.files += Dir.glob('lib/**/*')
21
+ s.files += Dir.glob('spec/**/*')
21
22
 
22
23
  s.add_development_dependency 'rake'
23
24
  s.add_development_dependency 'resque'
@@ -26,6 +26,11 @@ describe Resque::Plugins::WaitingRoom do
26
26
  expect(DummyJob.waiting_room_redis_key)
27
27
  .to eq('DummyJob:remaining_performs')
28
28
  end
29
+
30
+ it 'can have args passed to' do
31
+ expect(DummyJob.waiting_room_redis_key('123', '111', '4444'))
32
+ .to eq('DummyJob:remaining_performs')
33
+ end
29
34
  end
30
35
 
31
36
  context 'custom matcher' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque-waiting-room
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julien Blanchard
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-19 00:00:00.000000000 Z
11
+ date: 2018-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -82,13 +82,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
82
  version: '0'
83
83
  requirements: []
84
84
  rubyforge_project: resque-waiting-room
85
- rubygems_version: 2.2.2
85
+ rubygems_version: 2.6.14
86
86
  signing_key:
87
87
  specification_version: 4
88
88
  summary: Put your Resque jobs in a waiting room
89
- test_files:
90
- - spec/resque/plugins/job_spec.rb
91
- - spec/resque/plugins/waiting_room_spec.rb
92
- - spec/spec_helper.rb
93
- - spec/support/dummy_job.rb
94
- - spec/support/matchers.rb
89
+ test_files: []