hookshot 0.1.1 → 0.2.0

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.
Files changed (3) hide show
  1. data/lib/hookshot.rb +18 -3
  2. data/lib/hookshot/version.rb +1 -1
  3. metadata +1 -1
@@ -5,9 +5,11 @@ require "hookshot/version"
5
5
 
6
6
  class Hookshot
7
7
 
8
- NEW_JOBS_LIST = "hookshot:jobs"
9
- DELAYED_SET = "hookshot:delayed"
10
- FAILURES_LIST = "hookshot:failures"
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
@@ -1,3 +1,3 @@
1
1
  class Hookshot
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hookshot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: