Skip to content

fix: do not wait for the timeout#140

Merged
rustatian merged 2 commits into
masterfrom
fix/allow-non-blocking
Oct 4, 2025
Merged

fix: do not wait for the timeout#140
rustatian merged 2 commits into
masterfrom
fix/allow-non-blocking

Conversation

@rustatian

@rustatian rustatian commented Oct 4, 2025

Copy link
Copy Markdown
Member

Reason for This PR

closes: roadrunner-server/roadrunner#2194

Description of Changes

  • Use an intermediate channel to convert a blocking ExtractMin call to a non-blocking (still blocking) call with the possibility to cancel the call early.

License Acceptance

By submitting this pull request, I confirm that my contribution is made under
the terms of the MIT license.

PR Checklist

[Author TODO: Meet these criteria.]
[Reviewer TODO: Verify that these criteria are met. Request changes if not]

  • All commits in this PR are signed (git commit -s).
  • The reason for this PR is clearly provided (issue no. or explanation).
  • The description of changes is clear and encompassing.
  • Any required documentation changes (code and docs) are included in this PR.
  • Any user-facing changes are mentioned in CHANGELOG.md.
  • All added/changed functionality is tested.

Summary by CodeRabbit

  • Refactor

    • Reworked job polling to use a non-blocking producer/consumer approach, improving responsiveness and throughput during task processing.
    • Adjusted initialization to set up background job delivery for pollers.
  • Bug Fixes

    • Ensured pollers shut down cleanly without hanging when stopping.
    • Prevented edge cases where job retrieval could stall the processing loop.
  • Chores

    • General stability improvements under high load and during shutdown scenarios.

Signed-off-by: Valery Piashchynski <piashchynski.valery@gmail.com>
@rustatian rustatian requested a review from Copilot October 4, 2025 11:34
@rustatian rustatian self-assigned this Oct 4, 2025
@rustatian rustatian added the bug Something isn't working label Oct 4, 2025
@coderabbitai

coderabbitai Bot commented Oct 4, 2025

Copy link
Copy Markdown
Contributor

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title Check ✅ Passed The title clearly summarizes the primary change—preventing the default timeout wait—and is directly tied to the main behavior change without unnecessary noise or vagueness.
Linked Issues Check ✅ Passed The changes implement the conversion of the blocking ExtractMin call into a cancelable channel-based operation, enabling early shutdown cancellation as described in issue #2194 and thus directly addressing the reported 30 second delay.
Out of Scope Changes Check ✅ Passed All modifications are focused on enabling early cancellation of the ExtractMin call via a new channel and related control‐flow updates, with no unrelated or extraneous changes in other files or functionality.
Description Check ✅ Passed The description follows the repository template with clear sections for the patch rationale, detailed change summary, license confirmation, and a completed checklist covering commits signing, issue linkage, documentation, changelog, and tests.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/allow-non-blocking

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5363cbe and bb94dca.

📒 Files selected for processing (2)
  • listener.go (2 hunks)
  • plugin.go (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • listener.go
  • plugin.go

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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes an issue where job pollers would block unnecessarily by converting the blocking ExtractMin queue operation to a non-blocking one with early cancellation capability. The fix addresses GitHub issue #2194 by introducing an intermediate channel that allows the extraction operation to be cancelled when the plugin is stopped.

  • Introduced a new channel minCh to act as a buffer between the blocking queue and non-blocking pollers
  • Modified the listener to use the new channel-based approach instead of direct queue extraction
  • Added an extractMin() goroutine that continuously feeds jobs from the queue to the channel

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
plugin.go Added minCh channel field and initialized it during plugin setup
listener.go Implemented extractMin() method and updated listener to use channel-based job consumption
go.work.sum Updated dependency checksums

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 88bc0e6 and 5363cbe.

⛔ Files ignored due to path filters (1)
  • go.work.sum is excluded by !**/*.sum
📒 Files selected for processing (2)
  • listener.go (2 hunks)
  • plugin.go (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
plugin.go (1)
job.go (1)
  • Job (7-18)
listener.go (1)
plugin.go (1)
  • Plugin (49-91)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Analyze (go)
  • GitHub Check: JOBS plugin (Go stable, PHP 8.4, OS ubuntu-latest)

Comment thread listener.go
Signed-off-by: Valery Piashchynski <piashchynski.valery@gmail.com>
@rustatian rustatian merged commit 2bc9b6c into master Oct 4, 2025
7 checks passed
@rustatian rustatian deleted the fix/allow-non-blocking branch October 4, 2025 12:52
@codecov

codecov Bot commented Oct 4, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.00%. Comparing base (88bc0e6) to head (bb94dca).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@      Coverage Diff      @@
##   master   #140   +/-   ##
=============================
=============================

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[🐛 BUG]: Jobs plugin gets destroyed after 30 seconds on roadrunner shutdown

2 participants