Skip to content

[management] revert ctx dependency in get account with backpressure#5878

Merged
crn4 merged 1 commit intomainfrom
fix/context-cancel
Apr 14, 2026
Merged

[management] revert ctx dependency in get account with backpressure#5878
crn4 merged 1 commit intomainfrom
fix/context-cancel

Conversation

@crn4
Copy link
Copy Markdown
Contributor

@crn4 crn4 commented Apr 14, 2026

Describe your changes

the pr revert ctx cancel dependency on GetAccountWithBackpressure

Issue ticket number and link

Stack

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)

By submitting this pull request, you confirm that you have read and agree to the terms of the Contributor License Agreement.

Documentation

Select exactly one:

  • I added/updated documentation for this change
  • Documentation is not needed for this change (explain why)

bug fix

Docs PR URL (required if "docs added" is checked)

Paste the PR link from https://github.com/netbirdio/docs here:

https://github.com/netbirdio/docs/pull/__

Summary by CodeRabbit

  • Bug Fixes
    • Modified account request handling to change cancellation behavior during request transmission and result retrieval.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 14, 2026

📝 Walkthrough

Walkthrough

The GetAccountWithBackpressure function in the account request buffer was modified to remove context cancellation checks. It now performs an unconditional blocking send to the request channel and awaits the result without respecting context cancellation during these operations.

Changes

Cohort / File(s) Summary
Context Cancellation Removal
management/server/account_request_buffer.go
Removed ctx.Done() checks in GetAccountWithBackpressure during request sending and result retrieval; replaced select-based cancellation handling with unconditional blocking operations.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested reviewers

  • pappz

Poem

🐰 A backpressure flow now stands tall,
No context to heed the cancellation call,
The blocking send marches on with might,
Whether the context withers or glows bright,
Control yields to unstoppable flight! 🚀

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed The description covers the key aspects (bug fix classification, documentation not needed explanation, acknowledgment of CLA), though it lacks detail about the technical rationale for reverting the ctx dependency.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title directly describes the main change: reverting context cancellation handling in GetAccountWithBackpressure, which matches the technical summary showing removal of ctx.Done() checks and select-based cancellation flow.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/context-cancel

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.

@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@management/server/account_request_buffer.go`:
- Around line 66-68: The current unconditional send to ac.getAccountRequestCh
and receive from req.ResultChan can block forever after
processGetAccountRequests() exits; change both operations to use select: when
sending the request to ac.getAccountRequestCh (where req is the request struct
with ResultChan), select between ac.getAccountRequestCh <- req, ctx.Done(), and
the buffer shutdown signal (the lifecycle stop channel used by
processGetAccountRequests()) so the caller can bail if its context is cancelled
or the buffer is shutting down; likewise, when waiting for the response, select
between <-req.ResultChan, ctx.Done(), and the same shutdown signal and return an
appropriate error on context cancel/shutdown instead of blocking indefinitely
(reference functions/values: getAccountRequestCh, processGetAccountRequests(),
req.ResultChan, ctx and the buffer lifecycle shutdown channel).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 66da488c-f5c9-4d2c-9b9c-145adb7f4023

📥 Commits

Reviewing files that changed from the base of the PR and between 4eed459 and ae840a4.

📒 Files selected for processing (1)
  • management/server/account_request_buffer.go

Comment thread management/server/account_request_buffer.go
@crn4 crn4 changed the title revert ctx dependency in get account with backpressure [management] revert ctx dependency in get account with backpressure Apr 14, 2026
Comment thread management/server/account_request_buffer.go
@crn4 crn4 merged commit 7f666b8 into main Apr 14, 2026
45 of 47 checks passed
@crn4 crn4 deleted the fix/context-cancel branch April 14, 2026 10:16
pascal-fischer pushed a commit that referenced this pull request Apr 14, 2026
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.

3 participants