resque-cleaner 0.2.8 → 0.2.9

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.2.9 (2012-05-10)
2
+
3
+ * Make limiter configurable on resque-web.
4
+
1
5
  ## 0.2.8 (2012-03-19)
2
6
 
3
7
  * UI tweak (#15)
data/README.markdown CHANGED
@@ -1,9 +1,8 @@
1
- ResqueCleaner [ ![Travis-CI](https://secure.travis-ci.org/ono/resque-cleaner.png?branch=master "Travis CI") ](http://travis-ci.org/ono/resque-cleaner "Travis CI for resque-cleaner")
2
- ==============
1
+ ResqueCleaner [![Travis-CI](https://secure.travis-ci.org/ono/resque-cleaner.png?branch=master)](http://travis-ci.org/ono/resque-cleaner) [![Dependency Status](https://gemnasium.com/ono/resque-cleaner.png)](https://gemnasium.com/ono/resque-cleaner)
2
+ =============
3
3
 
4
4
  [github.com/ono/resque-cleaner](https://github.com/ono/resque-cleaner)
5
5
 
6
-
7
6
  Description
8
7
  -----------
9
8
 
@@ -30,10 +29,32 @@ Resque-Web integration
30
29
  ![Screen 1](https://github.com/ono/resque-cleaner/raw/master/misc/resque-cleaner-main.png)
31
30
  ![Screen 2](https://github.com/ono/resque-cleaner/raw/master/misc/resque-cleaner-list.png)
32
31
 
33
- You have to load ResqueCleaner to enable the Cleaner tab.
32
+
33
+ Configuration
34
+ -------------
35
+
36
+ At first, you have to load ResqueCleaner to enable the Cleaner tab. Here is
37
+ an example step.
38
+
39
+ 1. Create a configuration file for resque-web
40
+ <br/>```touch [app_dir]/config/resque-web.rb```
41
+
42
+ 2. Add the following line into the file
43
+ <br/>```require 'resque-cleaner'```
44
+
45
+ 3. Then pass the file when you start resque-web
46
+ <br/>```% resque-web [app_dir]/config/resque-web.rb```
47
+
48
+ You can also configure [limiter](https://github.com/ono/resque-cleaner#limiter)
49
+ in the file.
50
+
51
+ e.g.
34
52
 
35
53
  ```ruby
36
- require 'resque-cleaner'
54
+ require 'resque-cleaner'
55
+ module Resque::Plugins
56
+ ResqueCleaner::Limiter.default_maximum = 10_000
57
+ end
37
58
  ```
38
59
 
39
60
  Console
@@ -192,11 +192,22 @@ module Resque
192
192
  # Through the Limiter class, you accesses only the last x(default 1000)
193
193
  # jobs.
194
194
  class Limiter
195
- DEFAULT_MAX_JOBS = 1000
195
+ @@default_maximum ||= 1000
196
+
197
+ class << self
198
+ def default_maximum
199
+ @@default_maximum
200
+ end
201
+
202
+ def default_maximum=(v)
203
+ @@default_maximum = v
204
+ end
205
+ end
206
+
196
207
  attr_accessor :maximum
197
208
  def initialize(cleaner)
198
209
  @cleaner = cleaner
199
- @maximum = DEFAULT_MAX_JOBS
210
+ @maximum = @@default_maximum
200
211
  @locked = false
201
212
  end
202
213
 
@@ -179,4 +179,16 @@ context "ResqueCleaner" do
179
179
  first = @cleaner.select[0]
180
180
  assert_equal "Jack", first["payload"]["args"][0]
181
181
  end
182
+
183
+ test "allows you to configure limiter" do
184
+ c = Resque::Plugins::ResqueCleaner.new
185
+ assert_not_equal c.limiter.maximum, 10_000
186
+
187
+ module Resque::Plugins
188
+ ResqueCleaner::Limiter.default_maximum = 10_000
189
+ end
190
+
191
+ c = Resque::Plugins::ResqueCleaner.new
192
+ assert_equal c.limiter.maximum, 10_000
193
+ end
182
194
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque-cleaner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.8
4
+ version: 0.2.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-19 00:00:00.000000000 Z
12
+ date: 2012-05-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: resque
16
- requirement: &70168447367980 !ruby/object:Gem::Requirement
16
+ requirement: &70346107929160 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '1.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70168447367980
24
+ version_requirements: *70346107929160
25
25
  description: ! ' resque-cleaner maintains the cleanliness of failed jobs on Resque.
26
26
 
27
27
  '