Skip to content

chore: add logs when requeueing due to row lock#541

Merged
adityachoudhari26 merged 3 commits intomainfrom
add-delays
May 2, 2025
Merged

chore: add logs when requeueing due to row lock#541
adityachoudhari26 merged 3 commits intomainfrom
add-delays

Conversation

@adityachoudhari26
Copy link
Copy Markdown
Member

@adityachoudhari26 adityachoudhari26 commented May 2, 2025

Summary by CodeRabbit

  • Bug Fixes
    • Added informational logging for database row lock errors during job processing, improving visibility into retries.
    • Retrying jobs on row lock errors now includes detailed logs without changing the retry behavior.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented May 2, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This change updates four worker modules in the event worker application to add structured logging when a PostgreSQL row lock error (code "55P03") occurs during a transaction. Upon detecting this error, the workers now log an informational message including job details before re-queuing the job immediately without any delay. The retry logic is unchanged except for the added logging. There are no changes to exported or public entity declarations.

Changes

File(s) Change Summary
apps/event-worker/src/workers/compute-deployment-resource-selector.ts Added structured logging before immediately retrying jobs on row lock errors (code 55P03).
apps/event-worker/src/workers/compute-environment-resource-selector.ts Added structured logging before immediately retrying jobs on row lock errors (code 55P03).
apps/event-worker/src/workers/compute-policy-target-release-target-selector.ts Added structured logging before immediately retrying jobs on row lock errors (code 55P03).
apps/event-worker/src/workers/compute-systems-release-targets.ts Added structured logging before immediately retrying jobs on row lock errors (code 55P03).

Possibly related PRs

  • ctrlplanedev/ctrlplane#524: Removes the 500ms delay before retrying jobs on row lock errors, which is the opposite of this PR and directly related to the retry logic in the same worker files.

Suggested reviewers

  • jsbroks

Poem

A hop, a skip, a log in sight,
When row locks block the path just right—
The worker notes with cheerful cheer,
"Hold tight, job, I'll try again near!"
No pause, no wait, just swift retry,
The code hops on, beneath the sky!
🐇✨


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6f3bb24 and a00473e.

📒 Files selected for processing (4)
  • apps/event-worker/src/workers/compute-deployment-resource-selector.ts (2 hunks)
  • apps/event-worker/src/workers/compute-environment-resource-selector.ts (2 hunks)
  • apps/event-worker/src/workers/compute-policy-target-release-target-selector.ts (2 hunks)
  • apps/event-worker/src/workers/compute-systems-release-targets.ts (2 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@adityachoudhari26 adityachoudhari26 changed the title perf: add delays to requeueing chore: add logs when requeueing due to row lock May 2, 2025
@adityachoudhari26 adityachoudhari26 merged commit 4e9feab into main May 2, 2025
3 of 6 checks passed
@adityachoudhari26 adityachoudhari26 deleted the add-delays branch May 2, 2025 19:38
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