Release executor slot if not executing - #23396
Conversation
|
👋 yashnevatia, thanks for creating this pull request! To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team. Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks! |
|
✅ No conflicts with other open PRs targeting |
|
I see you updated files related to
|
|
| @@ -223,9 +250,21 @@ func (e *ServerRequest) Evictable(minRetention time.Duration) bool { | |||
| } | |||
|
|
|||
| func (e *ServerRequest) Cancel(ctx context.Context, err types.Error, msg string) error { | |||
There was a problem hiding this comment.
Introduced changes maintain the original behavior, but the original behavior does not make sense to me.
- Cancel is expected to just send a signal for cancellation, not wait for completion of the corresponding task. If execution started before Cancel is called, we'll just wait for its completion; if it was successful, noop; if it failed, we override the error with a different one.
- When we send cancel, we just notify requestors but do not cancel the capability call itself.
There was a problem hiding this comment.
Same as above. nit: related to the original code.
We should minimize the places where setError is called. executeRequest should return the result and the error, and those should be set at a higher level
|




Previously:
Now:
stateMuxaround requesterList, to let other requests add to requester list and exit (so that executing request can sendResponses to all requesters) and blocked requests dont occupy slots just to send response.executionClaimedatomic variable to enable only one request to execute.stateMuxaround response and error to avoid race when writing/reading between requests.How to handle Cancel():
execDonechannel. If execution is in progress (i.eexecutionClaimedflag is true), we wait for it to finish (execDone channel will be closed by executing request once execution completes) and then we send timeout errors to requesters if response was not set by executing request.