resque-disable-job 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/README.md +7 -6
- data/lib/resque/disable_job/version.rb +1 -1
- data/lib/resque/plugins/disable_job/rule.rb +1 -0
- data/lib/resque/plugins/disable_job/stats.rb +7 -12
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e5443eca7a655fcfe205105c1db550c43bb9f32
|
4
|
+
data.tar.gz: f27ded11981d8260271c23788319f184bae52932
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5e0ba4713b9a816863e93c7f2f98a74eb5c1a27243e7ddf6eba1ceae60012b67a4e47594406a3db21f07717514e7088d5d540345131194ab26c4e21a04d29df
|
7
|
+
data.tar.gz: 3183fc7f2f292dce6eacfe2cf13649bce1ed74a41a2b3e26eb1a59dd6c5045d3afe25d79e25ea4afe82811024514a8134524fa1a524f07fe156422626c36e414
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -42,9 +42,9 @@ By default this will just raise `Resque::Job::DontPerform`. If you want to do mo
|
|
42
42
|
|
43
43
|
### Disabling a Job
|
44
44
|
|
45
|
-
In your application's console you can use the `Resque::Plugins::DisableJob.disable_job` method to disable a job.
|
45
|
+
In your application's console you can use the `Resque::Plugins::DisableJob::Job.disable_job` method to disable a job.
|
46
46
|
|
47
|
-
`Resque::Plugins::DisableJob.disable_job(job_name, matching_arguments, ttl = 3600)`
|
47
|
+
`Resque::Plugins::DisableJob::Job.disable_job(job_name, matching_arguments, ttl = 3600)`
|
48
48
|
|
49
49
|
Note: By default, each rule has a ttl of 1 hour. This is because disabling a job should be a temporary action.
|
50
50
|
|
@@ -74,11 +74,12 @@ Resque::Plugins::DisableJob::Job.enable_all!
|
|
74
74
|
|
75
75
|
### Operations
|
76
76
|
|
77
|
-
`Resque::Plugins::DisableJob::Stats` comes with a a few methods that will help you keep track of actively disabled jobs and how many times the rule was matched.
|
77
|
+
`Resque::Plugins::DisableJob::Stats` comes with a a few methods that will help you keep track of actively disabled jobs and how many times the rule was matched.
|
78
|
+
They all return an `Array[Resque::Plugins::DisableJob::Rule]`.
|
78
79
|
|
79
|
-
* `all_disabled_jobs` -
|
80
|
-
* `job_disabled_rules(job_name)` -
|
81
|
-
* `disabled_stats` -
|
80
|
+
* `all_disabled_jobs` - a list of all the disabled jobs and their rules
|
81
|
+
* `job_disabled_rules(job_name)` - a list of all the rules for one particular job
|
82
|
+
* `disabled_stats` - all the disabled jobs, their rules, and the counter of how many times it was matched (the `Rule` objects have the `counter` attribute set)
|
82
83
|
|
83
84
|
## Development
|
84
85
|
|
@@ -9,25 +9,20 @@ module Resque
|
|
9
9
|
# These are methods that inspect the rules
|
10
10
|
class Stats
|
11
11
|
def self.all_disabled_jobs
|
12
|
-
|
12
|
+
Job.disabled_jobs.map { |name| job_disabled_rules(name) }.flatten
|
13
13
|
end
|
14
14
|
|
15
15
|
def self.job_disabled_rules(name)
|
16
|
-
Resque.redis.hgetall(Rule.new(name).all_rules_key)
|
16
|
+
Resque.redis.hgetall(Rule.new(name).all_rules_key).each_with_object([]) do |(digest, arguments), rules|
|
17
|
+
rules << Rule.new(name, arguments, digest)
|
18
|
+
end
|
17
19
|
end
|
18
20
|
|
19
21
|
def self.disabled_stats
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
job_name: name,
|
24
|
-
digest: digest,
|
25
|
-
arguments: arguments,
|
26
|
-
count: Resque.redis.get(Rule.new(name, arguments, digest).rule_key)
|
27
|
-
}
|
28
|
-
end
|
22
|
+
all_disabled_jobs.map do |rule|
|
23
|
+
rule.count = Resque.redis.get(rule.rule_key).to_i
|
24
|
+
rule
|
29
25
|
end
|
30
|
-
counts.flatten
|
31
26
|
end
|
32
27
|
end
|
33
28
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: resque-disable-job
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrei Balcanasu
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-12-
|
11
|
+
date: 2017-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: resque
|