Skip to content

Commit

Permalink
Fix incorrect log counts
Browse files Browse the repository at this point in the history
  • Loading branch information
ThorntonMatthew committed Aug 1, 2024
1 parent 65cf66d commit 1b965a4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/jobs/process_notification_status_updates_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ProcessNotificationStatusUpdatesJob < CaseflowJob
queue_with_priority :low_priority

MESSAGE_GROUP_ID = "VANotifyStatusUpdate" # Used to only process messages queued by the status update webhook
PROCESSING_LIMIT = 1000 # How many updates to perform per job execution
PROCESSING_LIMIT = 5000 # How many updates to perform per job execution

# Consumes messages from the 'receive_notifications' FIFO SQS queue whose 'MessageGroupId'
# attribute matches MESSAGE_GROUP_ID, and then persists data contained within those messages
Expand All @@ -37,6 +37,8 @@ def perform
number_of_messages_processed = 0

number_of_messages_processed += process_batch_of_messages while number_of_messages_processed < PROCESSING_LIMIT
rescue Caseflow::Error::SqsQueueExhaustionError
Rails.logger.info("ProcessNotificationStatusUpdatesJob is exiting early due to the queue being empty.")
rescue StandardError => error
log_error(error)
raise error
Expand Down Expand Up @@ -74,7 +76,7 @@ def process_batch_of_messages
)

# Exit loop early if there does not seem to be any more messages.
return PROCESSING_LIMIT if response.messages.empty?
fail Caseflow::Error::SqsQueueExhaustionError if response.messages.empty?

filtered_messages = filter_messages_by_group_id(response.messages)

Expand Down
1 change: 1 addition & 0 deletions lib/caseflow/error.rb
Original file line number Diff line number Diff line change
Expand Up @@ -500,4 +500,5 @@ def initialize(msg = "The batch size of jobs must not exceed 10")

class SqsUnexpectedQueueTypeError < StandardError; end
class SqsQueueNotFoundError < StandardError; end
class SqsQueueExhaustionError < StandardError; end
end

0 comments on commit 1b965a4

Please sign in to comment.