resque-throttle 0.2.6 → 0.2.7

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.6
1
+ 0.2.7
@@ -1,10 +1,11 @@
1
1
  module Resque
2
+ class SettingNotFound < RuntimeError; end
3
+
2
4
  class ThrottledJob
3
5
 
4
6
  THROTTLE_DEFAULTS = {
5
7
  :can_run_every => 1800,
6
8
  :disabled => false,
7
- :identifier => nil
8
9
  }
9
10
 
10
11
  def self.settings
@@ -15,20 +16,20 @@ module Resque
15
16
  settings.merge!(args)
16
17
  end
17
18
 
18
- def self.key
19
- [self.to_s, identifier].compact.join(":")
19
+ def self.identifier(*args)
20
+ end
21
+
22
+ def self.key(*args)
23
+ [self.to_s, identifier(*args)].compact.join(":")
20
24
  end
21
25
 
22
26
  def self.can_run_every
23
27
  settings[:can_run_every]
24
28
  end
25
-
29
+
26
30
  def self.disabled
27
31
  settings[:disabled]
28
32
  end
29
-
30
- def self.identifier
31
- settings[:identifier]
32
- end
33
+
33
34
  end
34
35
  end
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{resque-throttle}
8
- s.version = "0.2.6"
8
+ s.version = "0.2.7"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Scott J. Tamosunas"]
@@ -7,8 +7,7 @@ class ThrottledJobTest < Test::Unit::TestCase
7
7
  assert Resque::ThrottledJob.new
8
8
  end
9
9
 
10
- context "settings (private methods)" do
11
-
10
+ context "settings" do
12
11
  context "#can_run_every" do
13
12
  should "return the number of seconds in which to throttle these jobs" do
14
13
  assert_equal 3600, OneHourThrottledJob.can_run_every
data/test/test_helper.rb CHANGED
@@ -30,10 +30,15 @@ end
30
30
 
31
31
  class IdetifierThrottledJob < Resque::ThrottledJob
32
32
  @queue = :some_queue
33
- throttle :identifier => "my_identifier"
33
+
34
+ throttle :can_run_every => 3600
34
35
 
35
36
  def self.perform(some_id, some_other_thing)
36
37
  end
38
+
39
+ def self.identifier(*args)
40
+ "my_identifier"
41
+ end
37
42
  end
38
43
 
39
44
  class DisabledThrottledJob < Resque::ThrottledJob
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque-throttle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott J. Tamosunas