pegasus 0.0.3 → 0.0.4
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 +4 -3
- data/lib/pegasus/service/instance_methods.rb +6 -0
- data/lib/pegasus.rb +10 -0
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.4
|
@@ -5,8 +5,9 @@ module Pegasus
|
|
5
5
|
extend Forwardable
|
6
6
|
def_delegators :redis, :rpush, :llen, :lindex, :get, :set, :del, :lpop, :incrby
|
7
7
|
|
8
|
-
def playout svcs
|
9
|
-
@svcs
|
8
|
+
def playout *svcs
|
9
|
+
@svcs ||= []
|
10
|
+
@svcs.concat svcs.map{ |s| s.instance }
|
10
11
|
true while @svcs.any?{ |s| s.play }
|
11
12
|
end
|
12
13
|
|
@@ -33,7 +34,7 @@ module Pegasus
|
|
33
34
|
end
|
34
35
|
|
35
36
|
def wait ticket_no
|
36
|
-
|
37
|
+
@instance.play if @instance
|
37
38
|
logger.debug "waiting on ticket #{ticket_no}"
|
38
39
|
blpop ticket_no, 0
|
39
40
|
del ticket_no
|
@@ -32,6 +32,12 @@ module Pegasus
|
|
32
32
|
logger.info "#{self.class.name} NOOP"
|
33
33
|
end
|
34
34
|
|
35
|
+
def discard_queue!
|
36
|
+
backup_key = "#{wait_queue_key}_backup_#{Time.unix}"
|
37
|
+
renamenx wait_queue_key, backup_key
|
38
|
+
backup_key
|
39
|
+
end
|
40
|
+
|
35
41
|
def play
|
36
42
|
while next_task = lpop(wait_queue_key)
|
37
43
|
run_task next_task
|
data/lib/pegasus.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 4
|
9
|
+
version: 0.0.4
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Joe Edelman
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-09-
|
17
|
+
date: 2010-09-27 00:00:00 -07:00
|
18
18
|
default_executable: pegasus
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|