pegasus 0.0.5 → 0.0.6
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.
- data/VERSION +1 -1
- data/lib/pegasus/service/class_methods.rb +7 -1
- data/lib/pegasus/service/instance_methods.rb +0 -6
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.6
|
@@ -3,7 +3,7 @@ module Pegasus
|
|
3
3
|
def instance; @instance ||= new; end
|
4
4
|
|
5
5
|
extend Forwardable
|
6
|
-
def_delegators :redis, :rpush, :llen, :lindex, :get, :set, :del, :lpop, :incrby
|
6
|
+
def_delegators :redis, :rpush, :llen, :lindex, :get, :set, :del, :lpop, :incrby, :renamenx
|
7
7
|
|
8
8
|
def playout *svcs
|
9
9
|
@svcs ||= []
|
@@ -52,6 +52,12 @@ module Pegasus
|
|
52
52
|
queue_with_ticket(nil, *a)
|
53
53
|
end
|
54
54
|
|
55
|
+
def discard_queue!
|
56
|
+
backup_key = "#{wait_queue_key}_backup_#{Time.unix}"
|
57
|
+
renamenx wait_queue_key, backup_key
|
58
|
+
backup_key
|
59
|
+
end
|
60
|
+
|
55
61
|
def trouble?
|
56
62
|
return false unless next_task = lindex(wait_queue_key, 0)
|
57
63
|
seconds_behind = Time.unix - next_task.split(' ', 2)[0].to_i
|
@@ -32,12 +32,6 @@ module Pegasus
|
|
32
32
|
logger.info "#{self.class.name} NOOP"
|
33
33
|
end
|
34
34
|
|
35
|
-
def do_discard_queue!
|
36
|
-
backup_key = "#{wait_queue_key}_backup_#{Time.unix}"
|
37
|
-
renamenx wait_queue_key, backup_key
|
38
|
-
backup_key
|
39
|
-
end
|
40
|
-
|
41
35
|
def play
|
42
36
|
while next_task = lpop(wait_queue_key)
|
43
37
|
run_task next_task
|