eventq_aws 1.16.1 → 1.16.2
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 +0 -4
- data/lib/eventq_aws/aws_queue_client.rb +1 -28
- data/lib/eventq_aws/aws_queue_worker.rb +12 -20
- data/lib/eventq_aws/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e15c0b3ea491947a4e5b4def3a7f51bc4d67931e
|
4
|
+
data.tar.gz: a7de217ebfaa2ff6fb60c9f3ed24502157a48342
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05c258c6081057650aacc7731d464f676bf6f0871938cb2316644948455289470b49ff57e3ed0210dbb59e41b701841919548bf2e778c98a2b7817061b06528a
|
7
|
+
data.tar.gz: f1f95c3991299bcc67177e3c5158a67fd616a275568e9ae295752047e1b75fc9d7becdc1a17af3d27220949cb80157abc202d597f5bae386868a6c9004df3e9c
|
@@ -13,9 +13,6 @@ module EventQ
|
|
13
13
|
|
14
14
|
@aws_account = options[:aws_account_number]
|
15
15
|
|
16
|
-
@sns_keep_alive_timeout = options[:sns_keep_alive_timeout] || 30
|
17
|
-
@sns_continue_timeout = options[:sns_continue_timeout] || 15
|
18
|
-
|
19
16
|
if options.has_key?(:aws_region)
|
20
17
|
@aws_region = options[:aws_region]
|
21
18
|
Aws.config[:region] = @aws_region
|
@@ -31,10 +28,7 @@ module EventQ
|
|
31
28
|
|
32
29
|
# Returns the AWS SNS Client
|
33
30
|
def sns
|
34
|
-
@sns ||= Aws::SNS::Client.new
|
35
|
-
http_idle_timeout: @sns_keep_alive_timeout,
|
36
|
-
http_continue_timeout: @sns_continue_timeout
|
37
|
-
)
|
31
|
+
@sns ||= Aws::SNS::Client.new
|
38
32
|
end
|
39
33
|
|
40
34
|
def get_topic_arn(event_type)
|
@@ -69,27 +63,6 @@ module EventQ
|
|
69
63
|
return name[0..79].gsub(/[^a-zA-Z\d_\-]/,'')
|
70
64
|
end
|
71
65
|
|
72
|
-
def keep_alive(connections: 15, interval: 1.5)
|
73
|
-
connections.times do
|
74
|
-
Thread.new do
|
75
|
-
while true do
|
76
|
-
begin
|
77
|
-
Seahorse::Client::NetHttp::ConnectionPool.pools.each do |cp|
|
78
|
-
pool = cp.instance_variable_get(:@pool)
|
79
|
-
pool.each do |k,v|
|
80
|
-
cp.session_for(URI(k)) do |session|
|
81
|
-
session.request(Net::HTTP::Get.new('/'))
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
rescue
|
86
|
-
# swallow error and do nothing
|
87
|
-
end
|
88
|
-
sleep interval
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
66
|
end
|
94
67
|
end
|
95
68
|
end
|
@@ -49,17 +49,15 @@ module EventQ
|
|
49
49
|
@forks = []
|
50
50
|
|
51
51
|
if @fork_count > 1
|
52
|
-
|
53
|
-
|
54
|
-
|
52
|
+
Thread.new do
|
53
|
+
@fork_count.times do
|
54
|
+
pid = fork do
|
55
|
+
start_process(options, queue, block)
|
56
|
+
end
|
57
|
+
@forks.push(pid)
|
55
58
|
end
|
56
|
-
@forks.push(pid)
|
57
|
-
end
|
58
|
-
|
59
|
-
if options.key?(:wait) && options[:wait] == true
|
60
59
|
@forks.each { |pid| Process.wait(pid) }
|
61
60
|
end
|
62
|
-
|
63
61
|
else
|
64
62
|
start_process(options, queue, block)
|
65
63
|
end
|
@@ -82,7 +80,6 @@ module EventQ
|
|
82
80
|
#loop through each thread count
|
83
81
|
@thread_count.times do
|
84
82
|
thr = Thread.new do
|
85
|
-
|
86
83
|
client = options[:client]
|
87
84
|
manager = EventQ::Amazon::QueueManager.new({ client: client })
|
88
85
|
|
@@ -107,16 +104,13 @@ module EventQ
|
|
107
104
|
end
|
108
105
|
|
109
106
|
end
|
110
|
-
|
111
107
|
end
|
112
108
|
@threads.push(thr)
|
113
|
-
|
114
109
|
end
|
115
110
|
|
116
|
-
if options.key?(:wait) && options[:wait] == true
|
111
|
+
if (options.key?(:wait) && options[:wait] == true) || (options.key?(:fork_count) && options[:fork_count] > 1)
|
117
112
|
@threads.each { |thr| thr.join }
|
118
113
|
end
|
119
|
-
|
120
114
|
end
|
121
115
|
|
122
116
|
def gc_flush
|
@@ -138,7 +132,7 @@ module EventQ
|
|
138
132
|
|
139
133
|
begin
|
140
134
|
|
141
|
-
#request a message from the queue
|
135
|
+
# request a message from the queue
|
142
136
|
response = client.sqs.receive_message({
|
143
137
|
queue_url: q,
|
144
138
|
max_number_of_messages: 1,
|
@@ -346,17 +340,16 @@ module EventQ
|
|
346
340
|
end
|
347
341
|
|
348
342
|
def configure(queue, options = {})
|
349
|
-
|
350
343
|
@queue = queue
|
351
344
|
|
352
|
-
#default thread count
|
345
|
+
# default thread count
|
353
346
|
@thread_count = 5
|
354
347
|
if options.key?(:thread_count)
|
355
348
|
@thread_count = options[:thread_count]
|
356
349
|
end
|
357
350
|
|
358
|
-
#default sleep time in seconds
|
359
|
-
@sleep =
|
351
|
+
# default sleep time in seconds
|
352
|
+
@sleep = 0
|
360
353
|
if options.key?(:sleep)
|
361
354
|
@sleep = options[:sleep]
|
362
355
|
end
|
@@ -370,6 +363,7 @@ module EventQ
|
|
370
363
|
@gc_flush_interval = options[:gc_flush_interval]
|
371
364
|
end
|
372
365
|
|
366
|
+
@queue_poll_wait = 15
|
373
367
|
if options.key?(:queue_poll_wait)
|
374
368
|
@queue_poll_wait = options[:queue_poll_wait]
|
375
369
|
end
|
@@ -377,9 +371,7 @@ module EventQ
|
|
377
371
|
EventQ.logger.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}.")
|
378
372
|
|
379
373
|
return true
|
380
|
-
|
381
374
|
end
|
382
|
-
|
383
375
|
end
|
384
376
|
end
|
385
377
|
end
|
data/lib/eventq_aws/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eventq_aws
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.16.
|
4
|
+
version: 1.16.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- vaughanbrittonsage
|
@@ -56,16 +56,16 @@ dependencies:
|
|
56
56
|
name: aws-sdk-core
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
61
|
+
version: '2.0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
68
|
+
version: '2.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: eventq_base
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|