Skip to content
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

Ignore repeated TransferSIPParticipant RPC request with same parameters #195

Merged
merged 2 commits into from
Oct 11, 2024

Conversation

biglittlebigben
Copy link
Contributor

No description provided.

@biglittlebigben biglittlebigben requested a review from a team as a code owner October 9, 2024 21:01
if _, ok := s.pendingTransfers[k]; ok {
s.mu.Unlock()
s.log.Debugw("repeated request for call transfer", "callID", req.SipCallId, "transferTo", req.TransferTo)
return &emptypb.Empty{}, nil
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure what are the semantics here for PSRPC. Will it unblock earlier if the second request immediately succeeds by going this code path? Maybe use map[transferKey]<-chan struct{} and wait here for the channel to close?

Also, you intentionally remove cancellation from the original context, which is desired for the main call. But maybe it's worth preserving the original context in a separate var, so that you can then select on this new done channel + the context. I assume PSRPC will cancel the request after a timeout. So at least the follow-up requests will be unblocked.

Copy link
Contributor

@dennwc dennwc left a comment

Choose a reason for hiding this comment

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

Great, it's even better with a separate goroutine 👍

@biglittlebigben biglittlebigben merged commit 711a46e into main Oct 11, 2024
3 checks passed
@biglittlebigben biglittlebigben deleted the benjamin/transfer_idempotent branch October 11, 2024 15:09
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.

2 participants