Skip to content

Commit

Permalink
added ability to override visibility_timeout (default 30 seconds)
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaliito committed Jan 3, 2024
1 parent 82e26c0 commit 14369ab
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/pheme/queue_poller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def initialize(queue_url:,
poller_configuration: {},
sqs_client: nil,
idle_timeout: nil,
visibility_timeout: nil,
message_handler: nil,
&block_message_handler)
raise ArgumentError, "must specify non-nil queue_url" if queue_url.blank?
Expand All @@ -28,10 +29,12 @@ def initialize(queue_url:,
@poller_configuration = {
wait_time_seconds: 10, # amount of time a long polling receive call can wait for a message before receiving a empty response (which will trigger another polling request)
idle_timeout: 20, # disconnects poller after 20 seconds of idle time
visibility_timeout: 30, # amount of time to process and delete the message before it is added back into the queue
skip_delete: true, # manually delete messages
}.merge(poller_configuration || {})

@poller_configuration[:idle_timeout] = idle_timeout unless idle_timeout.nil?
@poller_configuration[:visibility_timeout] = visibility_timeout unless visibility_timeout.nil?

if message_handler
if message_handler.ancestors.include?(Pheme::MessageHandler)
Expand Down

0 comments on commit 14369ab

Please sign in to comment.