sidekiq_sqs_processor 0.1.3 → 0.1.5
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bfc8dddf71588f6a46ac8aee5b02acd1ddd48bf0d44c294b24c229735abaf87c
|
4
|
+
data.tar.gz: f10c3850a4db1047ad891af8b98727bef9e42e321f4e98ada9926e4cacfcd941
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dbe2db037698eff15909b12389f7b9cfb4a7729eb4499721182d7a9c96cde9ef7a39e9700e844695720b0399bfd222b23fa8bdbd6aba12e40f281c0eaff83390
|
7
|
+
data.tar.gz: e4e7c8efc7288ea0483c83b3d0d3923b239a276d01a0b3cd5f7a088cf13ace835bc1573539e69b8eebc77f4a407e02f95cb5fc657afabee749610b7fddea2daf
|
@@ -22,6 +22,25 @@ module SidekiqSqsProcessor
|
|
22
22
|
@mutex.synchronize do
|
23
23
|
puts "[SidekiqSqsProcessor] Inside start mutex"
|
24
24
|
begin
|
25
|
+
# Validate configuration before starting
|
26
|
+
unless SidekiqSqsProcessor.configuration.ready_for_polling?
|
27
|
+
puts "[SidekiqSqsProcessor] WARNING: Configuration not ready for polling. Skipping poller start."
|
28
|
+
puts "[SidekiqSqsProcessor] Queue workers: #{SidekiqSqsProcessor.configuration.queue_workers.inspect}"
|
29
|
+
return false
|
30
|
+
end
|
31
|
+
|
32
|
+
# Validate AWS credentials
|
33
|
+
begin
|
34
|
+
SidekiqSqsProcessor.sqs_client.get_queue_attributes(
|
35
|
+
queue_url: SidekiqSqsProcessor.configuration.queue_urls.first,
|
36
|
+
attribute_names: ["QueueArn"]
|
37
|
+
)
|
38
|
+
rescue Aws::SQS::Errors::ServiceError => e
|
39
|
+
puts "[SidekiqSqsProcessor] WARNING: AWS credentials validation failed: #{e.class} - #{e.message}"
|
40
|
+
puts "[SidekiqSqsProcessor] Skipping poller start due to AWS configuration issues"
|
41
|
+
return false
|
42
|
+
end
|
43
|
+
|
25
44
|
@running = true
|
26
45
|
start_polling_threads
|
27
46
|
puts "[SidekiqSqsProcessor] Polling threads started successfully"
|
@@ -82,7 +101,7 @@ module SidekiqSqsProcessor
|
|
82
101
|
end
|
83
102
|
|
84
103
|
def poll_queue(queue_url)
|
85
|
-
begin
|
104
|
+
begin
|
86
105
|
response = receive_messages(queue_url)
|
87
106
|
process_messages(response.messages, queue_url)
|
88
107
|
rescue StandardError => e
|
@@ -38,29 +38,35 @@ module SidekiqSqsProcessor
|
|
38
38
|
begin
|
39
39
|
puts "[SidekiqSqsProcessor] Initializing SQS poller in background thread..."
|
40
40
|
|
41
|
-
# Wait for up to
|
42
|
-
|
41
|
+
# Wait for up to 2 seconds for configuration to be ready
|
42
|
+
2.times do |i|
|
43
43
|
if SidekiqSqsProcessor.configuration.ready_for_polling?
|
44
44
|
puts "[SidekiqSqsProcessor] Configuration is ready, starting poller..."
|
45
|
-
SidekiqSqsProcessor.start_continuous_poller
|
46
|
-
|
45
|
+
if SidekiqSqsProcessor.start_continuous_poller
|
46
|
+
puts "[SidekiqSqsProcessor] Poller started successfully"
|
47
|
+
else
|
48
|
+
puts "[SidekiqSqsProcessor] WARNING: Poller failed to start but Sidekiq will continue running"
|
49
|
+
end
|
47
50
|
break
|
48
51
|
else
|
49
|
-
puts "[SidekiqSqsProcessor] Waiting for configuration to be ready... (#{i+1}/
|
52
|
+
puts "[SidekiqSqsProcessor] Waiting for configuration to be ready... (#{i+1}/2)" if i % 1 == 0
|
50
53
|
sleep 1
|
51
54
|
end
|
52
55
|
end
|
53
56
|
|
54
57
|
# Final check after timeout
|
55
58
|
unless SidekiqSqsProcessor.configuration.ready_for_polling?
|
56
|
-
puts "[SidekiqSqsProcessor] WARNING: Configuration not ready after
|
59
|
+
puts "[SidekiqSqsProcessor] WARNING: Configuration not ready after 2 seconds"
|
57
60
|
puts "[SidekiqSqsProcessor] WARNING: SQS polling will not start"
|
58
61
|
puts "[SidekiqSqsProcessor] WARNING: Current configuration state:"
|
59
62
|
puts "[SidekiqSqsProcessor] Queue workers: #{SidekiqSqsProcessor.configuration.queue_workers.inspect}"
|
63
|
+
puts "[SidekiqSqsProcessor] AWS Region: #{SidekiqSqsProcessor.configuration.aws_region}"
|
64
|
+
puts "[SidekiqSqsProcessor] Sidekiq will continue running without SQS polling"
|
60
65
|
end
|
61
66
|
rescue => e
|
62
67
|
puts "[SidekiqSqsProcessor] ERROR: Failed to start poller: #{e.class} - #{e.message}"
|
63
68
|
puts "[SidekiqSqsProcessor] ERROR: Backtrace: #{e.backtrace.join("\n")}"
|
69
|
+
puts "[SidekiqSqsProcessor] WARNING: Sidekiq will continue running without SQS polling"
|
64
70
|
# Log the error but don't crash the thread
|
65
71
|
end
|
66
72
|
end
|