Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for configurable dequeue size #3031

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/lib/message_dequeuer/initial_processor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def check_message_is_ready
def find_other_messages_for_batch
return unless Postal::Config.postal.batch_queued_messages?

@other_messages = @queued_message.batchable_messages(100)
@other_messages = @queued_message.batchable_messages(Postal::Config.postal.batch_queued_messages_limit)
log "found #{@other_messages.size} associated messages to process at the same time", batch_key: @queued_message.batch_key
rescue StandardError
@queued_message.unlock
Expand Down
2 changes: 2 additions & 0 deletions doc/config/yaml.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ postal:
queued_message_lock_stale_days: 1
# When enabled queued messages will be de-queued in batches based on their destination
batch_queued_messages: true
# When de-queuing in batches, use this limit for the batch size
batch_queued_messages_limit: 100

web_server:
# The default port the web server should listen on unless overriden by the PORT environment variable
Expand Down
5 changes: 5 additions & 0 deletions lib/postal/config_schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ module Postal
description "When enabled queued messages will be de-queued in batches based on their destination"
default true
end

integer :batch_queued_messages_limit do
description "When de-queuing in batches, use this limit for the batch size"
default 100
end
end

group :web_server do
Expand Down