fourkites-sqspoller 0.1.10 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/sqspoller/message_delegator.rb +2 -2
- data/lib/sqspoller/queue_controller.rb +2 -2
- data/lib/sqspoller/sqs_poller.rb +6 -6
- data/lib/sqspoller/worker_task.rb +2 -2
- data/sqspoller.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OWZlOWI3Y2UzNTg3MWJiYTkwNDU4MzlmYzVjNGRlNDFmYmE2ZTc3Mw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YTZmNDkyMmQ2NWYzNzAyMTdjYTY5MDQxYzlkNzMzZDcxNjk0NmE1OQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YzQwYzEzYjg3OTE5ZjBlZWJmODU2OTczZmM3ZjhmYTI3MzVlZDZmZDg5NWUw
|
10
|
+
MDY4YzVmNDQ4OGQ0MzQ3NTY1ODJkMzI3MDM4NWNjODEyMTdmNGI0NmFjZmFh
|
11
|
+
YTY3NWI2OWVlMTZkYjZiODI3YzcxNjYyNmQyYzFlNjliODdlODU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MTFmNGEzMGZjOTRhYmQ2Yzg3NmFjYzFlM2Q2ZGY1ZWZkMDUwZmJiYzQxOTZm
|
14
|
+
ZGMyMjE1OWY4NTM0NmRiYTQ4MTBhMWNhYjNiYmRkYmU4Y2ZlYWJjNjNjOWU1
|
15
|
+
NDNlYWZmZDNkMjhjN2U2NWFlOWYwZDg5YzI1NTBiMjk1NTg1OTM=
|
@@ -5,8 +5,8 @@ require "net/http"
|
|
5
5
|
module Sqspoller
|
6
6
|
class MessageDelegator
|
7
7
|
|
8
|
-
def initialize(worker_thread_pool_size, waiting_tasks_ratio, worker_task)
|
9
|
-
@logger = Logger.new(
|
8
|
+
def initialize(worker_thread_pool_size, waiting_tasks_ratio, worker_task, logger_file)
|
9
|
+
@logger = Logger.new(logger_file)
|
10
10
|
@worker_thread_pool_size = worker_thread_pool_size
|
11
11
|
@max_allowed_queue_size = waiting_tasks_ratio * worker_thread_pool_size
|
12
12
|
@semaphore = Mutex.new
|
@@ -6,8 +6,8 @@ require "aws-sdk"
|
|
6
6
|
module Sqspoller
|
7
7
|
class QueueController
|
8
8
|
|
9
|
-
def initialize(queue_name, polling_threads_count, task_delegator, access_key_id, secret_access_key, region)
|
10
|
-
@logger = Logger.new(
|
9
|
+
def initialize(queue_name, polling_threads_count, task_delegator, access_key_id, secret_access_key, region, logger_file)
|
10
|
+
@logger = Logger.new(logger_file)
|
11
11
|
@queue_name = queue_name
|
12
12
|
@polling_threads_count = polling_threads_count
|
13
13
|
@sqs = Aws::SQS::Client.new(:access_key_id => access_key_id, :secret_access_key => secret_access_key, :region => region)
|
data/lib/sqspoller/sqs_poller.rb
CHANGED
@@ -48,10 +48,10 @@ module Sqspoller
|
|
48
48
|
queues_config.keys.each { |queue|
|
49
49
|
total_poller_threads += queues_config[queue][:polling_threads]
|
50
50
|
}
|
51
|
-
message_delegator = initialize_worker config[:worker_configuration], total_poller_threads
|
51
|
+
message_delegator = initialize_worker config[:worker_configuration], total_poller_threads, logger_file
|
52
52
|
queues_config.keys.each { |queue|
|
53
53
|
@logger.info "Creating QueueController object for queue: #{queue}"
|
54
|
-
qc = QueueController.new queue, queues_config[queue][:polling_threads], message_delegator, access_key_id, secret_access_key, region
|
54
|
+
qc = QueueController.new queue, queues_config[queue][:polling_threads], message_delegator, access_key_id, secret_access_key, region, logger_file
|
55
55
|
qcs << qc
|
56
56
|
}
|
57
57
|
|
@@ -80,15 +80,15 @@ module Sqspoller
|
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
83
|
-
def initialize_worker(worker_configuration, total_poller_threads)
|
83
|
+
def initialize_worker(worker_configuration, total_poller_threads, logger_file)
|
84
84
|
worker_thread_count = worker_configuration[:concurrency]
|
85
|
-
worker_task = worker_configuration[:worker_class].split('::').inject(Object) {|o,c| o.const_get c}.new(worker_configuration)
|
85
|
+
worker_task = worker_configuration[:worker_class].split('::').inject(Object) {|o,c| o.const_get c}.new(worker_configuration, logger_file)
|
86
86
|
waiting_tasks_ratio = worker_configuration[:waiting_tasks_ratio]
|
87
87
|
waiting_tasks_ratio = 1 if waiting_tasks_ratio.nil?
|
88
88
|
if worker_thread_count.nil?
|
89
|
-
message_delegator = MessageDelegator.new total_poller_threads, waiting_tasks_ratio, worker_task
|
89
|
+
message_delegator = MessageDelegator.new total_poller_threads, waiting_tasks_ratio, worker_task, logger_file
|
90
90
|
else
|
91
|
-
message_delegator = MessageDelegator.new worker_thread_count, waiting_tasks_ratio, worker_task
|
91
|
+
message_delegator = MessageDelegator.new worker_thread_count, waiting_tasks_ratio, worker_task, logger_file
|
92
92
|
end
|
93
93
|
return message_delegator
|
94
94
|
end
|
@@ -7,8 +7,8 @@ module Sqspoller
|
|
7
7
|
|
8
8
|
class WorkerTask
|
9
9
|
|
10
|
-
def initialize(worker_configuration)
|
11
|
-
@logger = Logger.new(
|
10
|
+
def initialize(worker_configuration, logger_file)
|
11
|
+
@logger = Logger.new(logger_file)
|
12
12
|
@http_method = worker_configuration[:http_method]
|
13
13
|
@http_url = worker_configuration[:http_url]
|
14
14
|
@uri = URI(@http_url)
|
data/sqspoller.gemspec
CHANGED