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 +4 -0
- data/README.markdown +26 -5
- data/lib/resque_cleaner.rb +13 -2
- data/test/resque_cleaner_test.rb +12 -0
- metadata +4 -4
data/CHANGELOG.md
CHANGED
data/README.markdown
CHANGED
@@ -1,9 +1,8 @@
|
|
1
|
-
ResqueCleaner [
|
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
|
-
|
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
|
-
|
54
|
+
require 'resque-cleaner'
|
55
|
+
module Resque::Plugins
|
56
|
+
ResqueCleaner::Limiter.default_maximum = 10_000
|
57
|
+
end
|
37
58
|
```
|
38
59
|
|
39
60
|
Console
|
data/lib/resque_cleaner.rb
CHANGED
@@ -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
|
-
|
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 =
|
210
|
+
@maximum = @@default_maximum
|
200
211
|
@locked = false
|
201
212
|
end
|
202
213
|
|
data/test/resque_cleaner_test.rb
CHANGED
@@ -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.
|
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-
|
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: &
|
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: *
|
24
|
+
version_requirements: *70346107929160
|
25
25
|
description: ! ' resque-cleaner maintains the cleanliness of failed jobs on Resque.
|
26
26
|
|
27
27
|
'
|