hookshot 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/hookshot.rb +18 -3
- data/lib/hookshot/version.rb +1 -1
- metadata +1 -1
data/lib/hookshot.rb
CHANGED
@@ -5,9 +5,11 @@ require "hookshot/version"
|
|
5
5
|
|
6
6
|
class Hookshot
|
7
7
|
|
8
|
-
NEW_JOBS_LIST
|
9
|
-
DELAYED_SET
|
10
|
-
FAILURES_LIST
|
8
|
+
NEW_JOBS_LIST = "hookshot:jobs"
|
9
|
+
DELAYED_SET = "hookshot:delayed"
|
10
|
+
FAILURES_LIST = "hookshot:failures"
|
11
|
+
MANUAL_BLACKLIST = "hookshot:throttle:blacklist"
|
12
|
+
MANUAL_WHITELIST = "hookshot:throttle:whitelist"
|
11
13
|
|
12
14
|
FINAL_FAILURE = -1
|
13
15
|
|
@@ -50,6 +52,19 @@ class Hookshot
|
|
50
52
|
[nfailures.to_i, failed_id]
|
51
53
|
end
|
52
54
|
|
55
|
+
def force_blacklist(domain, duration)
|
56
|
+
redis.zadd(MANUAL_BLACKLIST, Time.now.to_i+duration, domain)
|
57
|
+
end
|
58
|
+
|
59
|
+
def force_whitelist(domain, duration)
|
60
|
+
redis.zadd(MANUAL_WHITELIST, Time.now.to_i+duration, domain)
|
61
|
+
end
|
62
|
+
|
63
|
+
def remove_override(domain)
|
64
|
+
redis.zrem(MANUAL_BLACKLIST, domain)
|
65
|
+
redis.zrem(MANUAL_WHITELIST, domain)
|
66
|
+
end
|
67
|
+
|
53
68
|
def queue_stats
|
54
69
|
pending, delayed, failures = redis.pipelined do
|
55
70
|
redis.llen NEW_JOBS_LIST
|
data/lib/hookshot/version.rb
CHANGED