symphony 0.12.3 → 0.12.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/ChangeLog +18 -4
- data/History.rdoc +8 -0
- data/lib/symphony/queue.rb +1 -0
- data/lib/symphony/task_group/longlived.rb +18 -11
- data/lib/symphony.rb +1 -1
- data/spec/symphony/task_group/longlived_spec.rb +19 -15
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ebf037000f9b9878dd653de8fef3bee18a87848355aacf48fecc7dba7a97fec
|
4
|
+
data.tar.gz: 139ee8cc122fe1bd388722a7a432df916b403109aabc404d9998cdaaa4dbc7d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b50d7c1491c8e152b457fb8bf200d1e886efba69a464e94fbde0555ab50a3dad7d0af6beb6c85671873538d650b5bc98b4ff8831f3de7505ffc6c62e8b323390
|
7
|
+
data.tar.gz: 1a6499dd59780c510f4f8e5b61f88e45de471c5453e4fd5d91857d2bb9e813a5d0b557b5a47b86579aec1766013d650a9e4da607f7c78e8ea3768ce3ec5381ac
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/ChangeLog
CHANGED
@@ -2,24 +2,38 @@
|
|
2
2
|
|
3
3
|
o * lib/symphony/daemon.rb:
|
4
4
|
| Observe with one description arg
|
5
|
-
| [
|
5
|
+
| [d9b6c47d9a4e] [tip]
|
6
6
|
|
|
7
7
|
2019-07-10 Michael Granger <ged@FaerieMUD.org>
|
8
8
|
|
9
9
|
o * lib/symphony/task.rb:
|
10
10
|
| Rearrange and observe salient methods
|
11
|
-
| [
|
11
|
+
| [732ca4f87efb]
|
12
12
|
|
|
13
13
|
2019-07-05 Michael Granger <ged@FaerieMUD.org>
|
14
14
|
|
15
15
|
o * .gems, Rakefile, lib/symphony.rb, lib/symphony/daemon.rb,
|
16
16
|
| lib/symphony/task.rb, lib/symphony/task_group.rb:
|
17
17
|
| Add speculative use of Observability
|
18
|
-
| [
|
18
|
+
| [e57c975ac790]
|
19
|
+
|
|
20
|
+
2019-07-11 Michael Granger <ged@FaerieMUD.org>
|
21
|
+
|
22
|
+
@ * .hgtags:
|
23
|
+
| Added tag v0.12.3 for changeset c785fccd2943
|
24
|
+
| [6c2e3d5d7eb1]
|
25
|
+
|
|
26
|
+
o * .hgsigs:
|
27
|
+
| Added signature for changeset 36e4b5500351
|
28
|
+
| [c785fccd2943] [v0.12.3]
|
29
|
+
|
|
30
|
+
o * History.rdoc, lib/symphony.rb, symphony.gemspec:
|
31
|
+
| Bump the patch version, update history.
|
32
|
+
| [36e4b5500351]
|
19
33
|
|
|
20
34
|
2019-07-10 Michael Granger <ged@FaerieMUD.org>
|
21
35
|
|
22
|
-
|
36
|
+
o * lib/symphony/task.rb, lib/symphony/task_group/longlived.rb,
|
23
37
|
| spec/symphony/task_group/longlived_spec.rb:
|
24
38
|
| Re-establish AMQP connections after the task fork
|
25
39
|
| [70a6afb0622a]
|
data/History.rdoc
CHANGED
data/lib/symphony/queue.rb
CHANGED
@@ -35,8 +35,6 @@ class Symphony::TaskGroup::LongLived < Symphony::TaskGroup
|
|
35
35
|
return [ pid ]
|
36
36
|
end
|
37
37
|
|
38
|
-
@queue ||= self.get_message_counting_queue
|
39
|
-
|
40
38
|
return nil
|
41
39
|
end
|
42
40
|
|
@@ -44,11 +42,10 @@ class Symphony::TaskGroup::LongLived < Symphony::TaskGroup
|
|
44
42
|
### Return +true+ if the task group should scale up by one.
|
45
43
|
def needs_a_worker?
|
46
44
|
return true if self.workers.empty?
|
47
|
-
return false
|
48
|
-
|
45
|
+
queue = self.get_message_counting_queue or return false
|
49
46
|
|
50
47
|
# Calculate the number of workers across the whole broker
|
51
|
-
if ( cc =
|
48
|
+
if ( cc = queue.consumer_count ) >= self.max_workers
|
52
49
|
self.log.debug "%p: Already at max workers (%d)" % [ self.task_class, self.max_workers ]
|
53
50
|
return false
|
54
51
|
else
|
@@ -62,9 +59,10 @@ class Symphony::TaskGroup::LongLived < Symphony::TaskGroup
|
|
62
59
|
|
63
60
|
### Add the current number of workers to the samples.
|
64
61
|
def sample_queue_status
|
65
|
-
return
|
62
|
+
return if self.workers.empty?
|
66
63
|
|
67
|
-
|
64
|
+
queue = self.get_message_counting_queue or return
|
65
|
+
count = queue.message_count
|
68
66
|
self.add_sample( count )
|
69
67
|
end
|
70
68
|
|
@@ -82,11 +80,20 @@ class Symphony::TaskGroup::LongLived < Symphony::TaskGroup
|
|
82
80
|
### Get a queue for counting the number of messages in the queue for this
|
83
81
|
### worker.
|
84
82
|
def get_message_counting_queue
|
85
|
-
|
86
|
-
|
83
|
+
@queue ||= begin
|
84
|
+
self.log.debug "Creating the message-counting queue."
|
85
|
+
channel = Symphony::Queue.amqp_channel
|
86
|
+
channel.queue( self.task_class.queue_name, passive: true, prefetch: 0 )
|
87
|
+
end
|
88
|
+
|
89
|
+
unless @queue.channel.open?
|
90
|
+
self.log.info "Message-counting queue's channel was closed: resetting."
|
91
|
+
Symphony::Queue.reset
|
92
|
+
@queue = nil
|
93
|
+
end
|
87
94
|
|
88
|
-
return queue
|
89
|
-
rescue Bunny::NotFound => err
|
95
|
+
return @queue
|
96
|
+
rescue Bunny::NotFound, Bunny::ChannelAlreadyClosed => err
|
90
97
|
self.log.info "Child hasn't created the queue yet; deferring"
|
91
98
|
Symphony::Queue.reset
|
92
99
|
|
data/lib/symphony.rb
CHANGED
@@ -23,6 +23,9 @@ describe Symphony::TaskGroup::LongLived do
|
|
23
23
|
def self::run
|
24
24
|
self.has_run = true
|
25
25
|
end
|
26
|
+
def self::name
|
27
|
+
return "TestTask"
|
28
|
+
end
|
26
29
|
end
|
27
30
|
end
|
28
31
|
|
@@ -75,8 +78,8 @@ describe Symphony::TaskGroup::LongLived do
|
|
75
78
|
|
76
79
|
allow( Process ).to receive( :setpgid )
|
77
80
|
|
78
|
-
channel = double( Bunny::Channel )
|
79
|
-
queue = double( Bunny::Queue )
|
81
|
+
channel = double( Bunny::Channel, open?: true )
|
82
|
+
queue = double( Bunny::Queue, channel: channel )
|
80
83
|
expect( Symphony::Queue ).to receive( :amqp_channel ).
|
81
84
|
and_return( channel )
|
82
85
|
expect( channel ).to receive( :queue ).
|
@@ -89,7 +92,8 @@ describe Symphony::TaskGroup::LongLived do
|
|
89
92
|
expect( queue ).to receive( :message_count ).and_return( *samples )
|
90
93
|
|
91
94
|
start = 1414002605
|
92
|
-
start.upto( start + samples.size
|
95
|
+
start.upto( start + samples.size ) do |time|
|
96
|
+
Loggability.logger.debug "Foom"
|
93
97
|
Timecop.freeze( time ) do
|
94
98
|
task_group.adjust_workers
|
95
99
|
end
|
@@ -106,8 +110,8 @@ describe Symphony::TaskGroup::LongLived do
|
|
106
110
|
|
107
111
|
allow( Process ).to receive( :setpgid )
|
108
112
|
|
109
|
-
channel = double( Bunny::Channel )
|
110
|
-
queue = double( Bunny::Queue )
|
113
|
+
channel = double( Bunny::Channel, open?: true )
|
114
|
+
queue = double( Bunny::Queue, channel: channel )
|
111
115
|
expect( Symphony::Queue ).to receive( :amqp_channel ).
|
112
116
|
and_return( channel )
|
113
117
|
expect( channel ).to receive( :queue ).
|
@@ -120,7 +124,7 @@ describe Symphony::TaskGroup::LongLived do
|
|
120
124
|
expect( queue ).to receive( :message_count ).and_return( *samples )
|
121
125
|
|
122
126
|
start = 1414002605
|
123
|
-
start.upto( start + samples.size
|
127
|
+
start.upto( start + samples.size ) do |time|
|
124
128
|
Timecop.freeze( time ) do
|
125
129
|
task_group.adjust_workers
|
126
130
|
end
|
@@ -136,8 +140,8 @@ describe Symphony::TaskGroup::LongLived do
|
|
136
140
|
|
137
141
|
allow( Process ).to receive( :setpgid )
|
138
142
|
|
139
|
-
channel = double( Bunny::Channel )
|
140
|
-
queue = double( Bunny::Queue )
|
143
|
+
channel = double( Bunny::Channel, open?: true )
|
144
|
+
queue = double( Bunny::Queue, channel: channel )
|
141
145
|
expect( Symphony::Queue ).to receive( :amqp_channel ).
|
142
146
|
and_return( channel )
|
143
147
|
expect( channel ).to receive( :queue ).
|
@@ -150,7 +154,7 @@ describe Symphony::TaskGroup::LongLived do
|
|
150
154
|
expect( queue ).to receive( :message_count ).and_return( *samples )
|
151
155
|
|
152
156
|
start = 1414002605
|
153
|
-
start.upto( start + samples.size
|
157
|
+
start.upto( start + samples.size ) do |time|
|
154
158
|
Timecop.freeze( time ) do
|
155
159
|
task_group.adjust_workers
|
156
160
|
end
|
@@ -166,8 +170,8 @@ describe Symphony::TaskGroup::LongLived do
|
|
166
170
|
|
167
171
|
allow( Process ).to receive( :setpgid )
|
168
172
|
|
169
|
-
channel = double( Bunny::Channel )
|
170
|
-
queue = double( Bunny::Queue )
|
173
|
+
channel = double( Bunny::Channel, open?: true )
|
174
|
+
queue = double( Bunny::Queue, channel: channel )
|
171
175
|
expect( Symphony::Queue ).to receive( :amqp_channel ).
|
172
176
|
and_return( channel )
|
173
177
|
expect( channel ).to receive( :queue ).
|
@@ -178,7 +182,7 @@ describe Symphony::TaskGroup::LongLived do
|
|
178
182
|
expect( queue ).to receive( :message_count ).and_return( *samples )
|
179
183
|
|
180
184
|
start = 1414002605
|
181
|
-
start.upto( start + samples.size
|
185
|
+
start.upto( start + samples.size ) do |time|
|
182
186
|
Timecop.freeze( time ) do
|
183
187
|
task_group.adjust_workers
|
184
188
|
end
|
@@ -194,8 +198,8 @@ describe Symphony::TaskGroup::LongLived do
|
|
194
198
|
|
195
199
|
allow( Process ).to receive( :setpgid )
|
196
200
|
|
197
|
-
channel = double( Bunny::Channel )
|
198
|
-
queue = double( Bunny::Queue )
|
201
|
+
channel = double( Bunny::Channel, open?: true )
|
202
|
+
queue = double( Bunny::Queue, channel: channel )
|
199
203
|
expect( Symphony::Queue ).to receive( :amqp_channel ).
|
200
204
|
and_return( channel )
|
201
205
|
expect( channel ).to receive( :queue ).
|
@@ -208,7 +212,7 @@ describe Symphony::TaskGroup::LongLived do
|
|
208
212
|
expect( queue ).to receive( :message_count ).and_return( *samples )
|
209
213
|
|
210
214
|
start = 1414002605
|
211
|
-
start.upto( start + samples.size
|
215
|
+
start.upto( start + samples.size ) do |time|
|
212
216
|
Timecop.freeze( time ) do
|
213
217
|
task_group.adjust_workers
|
214
218
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: symphony
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.
|
4
|
+
version: 0.12.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Granger
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
v4qqqa27Bs468d6SoPxjSm8a2mM9HZ4OdWhq4tFsbTeXDVquCfi64OTEaTt2xQdR
|
36
36
|
JnC4lpJfCP6aCXa5h2XAQfPSH636cQap
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2019-07-
|
38
|
+
date: 2019-07-12 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: configurability
|
metadata.gz.sig
CHANGED
Binary file
|