Skip to content

Run the visibility-extension timer at normal thread priority#1028

Draft
mensfeld wants to merge 1 commit into
mainfrom
fix/b4-visibility-timer-priority
Draft

Run the visibility-extension timer at normal thread priority#1028
mensfeld wants to merge 1 commit into
mainfrom
fix/b4-visibility-timer-priority

Conversation

@mensfeld

Copy link
Copy Markdown
Collaborator

TimerTask#execute starts the timer with Thread.new from the calling thread, so it inherits that thread's priority. Shoryuken runs workers at a lowered priority (Shoryuken.thread_priority, default -1) and starts the auto-visibility-extension timer from inside the worker thread, so the timer inherited -1. Combined with the first extension firing only after sleep(visibility_timeout - 5), a low-priority timer delayed under CPU contention can miss the visibility timeout and let SQS redeliver the still-processing message (double processing).

Reset the timer thread to normal priority (0) at the start of the loop.

TimerTask#execute starts the timer with Thread.new from the calling
thread, so it inherits that thread's priority. Shoryuken runs workers at
a lowered priority (Shoryuken.thread_priority, default -1) and starts the
auto-visibility-extension timer from inside the worker thread, so the
timer inherited -1. Combined with the first extension firing only after
sleep(visibility_timeout - 5), a low-priority timer delayed under CPU
contention can miss the visibility timeout and let SQS redeliver the
still-processing message (double processing).

Reset the timer thread to normal priority (0) at the start of the loop.
@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9a000513-7699-460c-b92b-c18a74e55a3b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/b4-visibility-timer-priority

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant