-
Notifications
You must be signed in to change notification settings - Fork 311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(gateway): send on closed chan - (*Handle).webRequestQ #4709
Conversation
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
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 as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
62cbf46
to
12198df
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #4709 +/- ##
==========================================
- Coverage 74.37% 74.35% -0.02%
==========================================
Files 427 427
Lines 49610 49614 +4
==========================================
- Hits 36895 36890 -5
- Misses 10274 10282 +8
- Partials 2441 2442 +1 ☔ View full report in Codecov by Sentry. |
If you wait for |
True.
The synchronisation introduced in this PR does the second part - waiting for shutdown to return and not exiting already. |
That's my point. We can do this by waiting on shutdown to complete, rather than introducing a counter. |
the
|
12198df
to
c4434f1
Compare
@lvrach I think we should determine the behaviour we want first. Upon cancellation we could:
|
I'm assuming this is not a SIGTERM exit, but for some reason
|
This PR is considered to be stale. It has been open 20 days with no further activity thus it is going to be closed in 7 days. To avoid such a case please consider removing the stale label manually or add a comment to the PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's see how it goes with this approach. Worst case we get killed after the grace period because some in-flight request is being slow, and that would still be better than a panic
so 👍
Description
Using a waitGroup to wait on all
in flight
requests before closing gateway workers'webRequestQ
.It is an anti-pattern to close a channel if there's multiple concurrent senders. So we make sure there's no more senders using a simple waitgroup(
inFlightRequests
). A middleware that adds andDone
s this waitgroup is then needed.Eventually during
Shutdown
we wait on this waitgroup before closing the workers'webRequestQ
channels. All the requests would have been handled by this point.Linear Ticket
Resolves PIPE-1072
Security