sqs_processor 0.1.3 → 0.1.4

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: c8c84fdb30ca8f133ccf09157614bd1aff65487f384a587abe975c2b883ca338
4
- data.tar.gz: f9177b02b2b713e1acbf5ce9fac29f9a13c48eee8454b07778df81dd7472ca09
3
+ metadata.gz: 64697b1de1623aae4f565a5fb479f7821a93929cae7962814481e81008ba8006
4
+ data.tar.gz: 9e0f1bee31f3f0925db9cbb4e98c053742f6e4cc658b9008e71ce72230ce1d87
5
5
  SHA512:
6
- metadata.gz: c0cae0d423be0b4605ab032007df401017836617d020f0b98062b45d8a5d7cb09b89d87111a7217199bb2b20392a29d9ea57e7904b3b72bc616c30ad66d42fcd
7
- data.tar.gz: 25fc1ea117532b69f30a34f71b03ca844bbb9ae9c6173c500e0b81ba943db085a76e0ae2425425b90bae5c9ab6dda878618bc3e6116f7ad336d2dd8635f072e8
6
+ metadata.gz: a02c92703472e7f58d44009e02b0a992211eb4f456c2ff274f58a7a7c4affae6b082d38143291d8838a4ecd81373a15787185d51e4882e39decd160acd2d75c8
7
+ data.tar.gz: 26b45ce1da7ec1fb3de5b99274d2d964c01b3deaf5a47efad7e27d97058b0c0d3522d09bbcb1e0aa3052126173e33a4a11dc03f8ecf068fa92f71460360f6d5c
data/README.md CHANGED
@@ -205,12 +205,13 @@ The processor handles termination signals gracefully:
205
205
  - **SIGQUIT**: Quit signal
206
206
 
207
207
  When a shutdown signal is received:
208
- 1. The processor stops accepting new messages
209
- 2. Completes processing of any current message batch
210
- 3. Logs the shutdown process
211
- 4. Exits cleanly
208
+ 1. The processor immediately interrupts any blocking operations (like SQS polling)
209
+ 2. Stops accepting new messages
210
+ 3. Completes processing of any current message batch
211
+ 4. Logs the shutdown process
212
+ 5. Exits cleanly
212
213
 
213
- This ensures that no messages are lost during deployments or process termination.
214
+ **Immediate Response**: Like Puma, the processor responds to shutdown signals immediately, interrupting any blocking operations without waiting for timeouts.
214
215
 
215
216
  ## Monitoring
216
217
 
@@ -45,16 +45,22 @@ module SQSProcessor
45
45
  Signal.trap('TERM') do
46
46
  logger.info 'Received SIGTERM, initiating graceful shutdown...'
47
47
  @shutdown_requested = true
48
+ # Immediately interrupt any blocking operations
49
+ Thread.main.raise Interrupt.new
48
50
  end
49
51
 
50
52
  Signal.trap('INT') do
51
53
  logger.info 'Received SIGINT, initiating graceful shutdown...'
52
54
  @shutdown_requested = true
55
+ # Immediately interrupt any blocking operations
56
+ Thread.main.raise Interrupt.new
53
57
  end
54
58
 
55
59
  Signal.trap('QUIT') do
56
60
  logger.info 'Received SIGQUIT, initiating graceful shutdown...'
57
61
  @shutdown_requested = true
62
+ # Immediately interrupt any blocking operations
63
+ Thread.main.raise Interrupt.new
58
64
  end
59
65
  end
60
66
 
@@ -69,6 +75,10 @@ module SQSProcessor
69
75
 
70
76
  receive_messages
71
77
  sleep 1 # Small delay between polling cycles
78
+ rescue Interrupt
79
+ logger.info 'Interrupted, initiating graceful shutdown...'
80
+ @shutdown_requested = true
81
+ break
72
82
  rescue StandardError => e
73
83
  logger.error "Error in message processing loop: #{e.message}"
74
84
  logger.error e.backtrace.join("\n")
@@ -98,6 +108,9 @@ module SQSProcessor
98
108
 
99
109
  process_single_message(message)
100
110
  end
111
+ rescue Interrupt
112
+ logger.info 'Interrupted during message reception...'
113
+ raise
101
114
  end
102
115
 
103
116
  def process_single_message(message)
@@ -1,3 +1,3 @@
1
1
  module SQSProcessor
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sqs_processor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Unni Tallman