eventq_aws 1.4.2 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/eventq_aws/aws_eventq_client.rb +5 -1
- data/lib/eventq_aws/aws_queue_worker.rb +35 -4
- data/lib/eventq_aws/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ccab4c39061946a12cdb2c529daf069aeef62ea
|
4
|
+
data.tar.gz: f4f3d6de57d1eb9dd72993da96f4d35e4a095940
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44ab5a51438ceb8882d4692f8415dcb9a916abcd4adbecbe544a3cce41dfebf6d5e0d9305e7b480baa89ad90cfc2a44609875fdf3da9e6fa4b16951971771aac
|
7
|
+
data.tar.gz: 2e50e09979808dc959edb0f693adecdb78d387ad427e12a63c3aa16871bfd241c56fee3c2ffd8f1f1a6305e1e0e3cd12bcfb861d02ec4a60c7bd4197ea09b381
|
@@ -18,7 +18,7 @@ module EventQ
|
|
18
18
|
|
19
19
|
topic_arn = @client.get_topic_arn(event_type)
|
20
20
|
|
21
|
-
qm =
|
21
|
+
qm = new_message
|
22
22
|
qm.content = event
|
23
23
|
qm.type = event_type
|
24
24
|
|
@@ -38,6 +38,10 @@ module EventQ
|
|
38
38
|
|
39
39
|
end
|
40
40
|
|
41
|
+
def new_message
|
42
|
+
EventQ::QueueMessage.new
|
43
|
+
end
|
44
|
+
|
41
45
|
end
|
42
46
|
end
|
43
47
|
end
|
@@ -17,6 +17,11 @@ module EventQ
|
|
17
17
|
|
18
18
|
@hash_helper = HashKit::Helper.new
|
19
19
|
@serialization_provider_manager = EventQ::SerializationProviders::Manager.new
|
20
|
+
|
21
|
+
@last_gc_flush = Time.now
|
22
|
+
@gc_flush_interval = 10
|
23
|
+
|
24
|
+
@queue_poll_wait = 10
|
20
25
|
end
|
21
26
|
|
22
27
|
def start(queue, options = {}, &block)
|
@@ -83,9 +88,9 @@ module EventQ
|
|
83
88
|
|
84
89
|
has_processed = thread_process_iteration(client, manager, queue, block)
|
85
90
|
|
86
|
-
|
91
|
+
gc_flush
|
87
92
|
|
88
|
-
if !has_processed
|
93
|
+
if !has_processed && @sleep > 0
|
89
94
|
EventQ.log(:debug, "[#{self.class}] - Sleeping for #{@sleep} seconds")
|
90
95
|
sleep(@sleep)
|
91
96
|
end
|
@@ -103,6 +108,17 @@ module EventQ
|
|
103
108
|
|
104
109
|
end
|
105
110
|
|
111
|
+
def gc_flush
|
112
|
+
if Time.now - last_gc_flush > @gc_flush_interval
|
113
|
+
GC.start
|
114
|
+
@last_gc_flush = Time.now
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
def last_gc_flush
|
119
|
+
@last_gc_flush
|
120
|
+
end
|
121
|
+
|
106
122
|
def thread_process_iteration(client, manager, queue, block)
|
107
123
|
#get the queue
|
108
124
|
q = manager.get_queue(queue)
|
@@ -116,7 +132,7 @@ module EventQ
|
|
116
132
|
response = client.sqs.receive_message({
|
117
133
|
queue_url: q,
|
118
134
|
max_number_of_messages: 1,
|
119
|
-
wait_time_seconds:
|
135
|
+
wait_time_seconds: @queue_poll_wait,
|
120
136
|
attribute_names: [APPROXIMATE_RECEIVE_COUNT]
|
121
137
|
})
|
122
138
|
|
@@ -182,6 +198,10 @@ module EventQ
|
|
182
198
|
|
183
199
|
EventQ.log(:debug, "[#{self.class}] - Message received. Retry Attempts: #{retry_attempts}")
|
184
200
|
|
201
|
+
if(!EventQ::NonceManager.is_allowed?(message.id))
|
202
|
+
return false
|
203
|
+
end
|
204
|
+
|
185
205
|
#begin worker block for queue message
|
186
206
|
begin
|
187
207
|
|
@@ -205,8 +225,11 @@ module EventQ
|
|
205
225
|
end
|
206
226
|
|
207
227
|
if abort || error
|
228
|
+
EventQ::NonceManager.failed(message.id)
|
208
229
|
EventQ.log(:info, "[#{self.class}] - Message rejected.")
|
209
230
|
reject_message(queue, client, msg, q, retry_attempts)
|
231
|
+
else
|
232
|
+
EventQ::NonceManager.complete(message.id)
|
210
233
|
end
|
211
234
|
|
212
235
|
yield [received, error]
|
@@ -282,7 +305,15 @@ module EventQ
|
|
282
305
|
@fork_count = options[:fork_count]
|
283
306
|
end
|
284
307
|
|
285
|
-
|
308
|
+
if options.key?(:gc_flush_interval)
|
309
|
+
@gc_flush_interval = options[:gc_flush_interval]
|
310
|
+
end
|
311
|
+
|
312
|
+
if options.key?(:queue_poll_wait)
|
313
|
+
@queue_poll_wait = options[:queue_poll_wait]
|
314
|
+
end
|
315
|
+
|
316
|
+
EventQ.log(:info, "[#{self.class}] - Configuring. Process Count: #{@fork_count} | Thread Count: #{@thread_count} | Interval Sleep: #{@sleep} | GC Flush Interval: #{@gc_flush_interval} | Queue Poll Wait: #{@queue_poll_wait}.")
|
286
317
|
|
287
318
|
return true
|
288
319
|
|
data/lib/eventq_aws/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eventq_aws
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- vaughanbrittonsage
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -84,16 +84,16 @@ dependencies:
|
|
84
84
|
name: eventq_base
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: '0'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: hash_kit
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|