gotd: assume any response is an ack

This commit is contained in:
Tulir Asokan
2026-03-28 16:44:17 +02:00
parent 472b9df44c
commit abae7b2854
2 changed files with 8 additions and 4 deletions

View File

@@ -10,11 +10,13 @@ func (e *Engine) NotifyAcks(ids []int64) {
defer e.mux.Unlock()
for _, id := range ids {
ch, ok := e.ack[id]
if !ok {
continue
}
e.notifyAckUnlocked(id)
}
}
func (e *Engine) notifyAckUnlocked(id int64) {
ch, ok := e.ack[id]
if ok {
close(ch)
delete(e.ack, id)
}

View File

@@ -231,6 +231,7 @@ func (e *Engine) retryUntilAck(ctx context.Context, req Request) (sent bool, err
// NotifyResult notifies engine about received RPC response.
func (e *Engine) NotifyResult(msgID int64, b *bin.Buffer) error {
e.mux.Lock()
e.notifyAckUnlocked(msgID)
fn, ok := e.rpc[msgID]
e.mux.Unlock()
if !ok {
@@ -245,6 +246,7 @@ func (e *Engine) NotifyResult(msgID int64, b *bin.Buffer) error {
func (e *Engine) NotifyError(msgID int64, rpcErr error) {
e.onError(rpcErr)
e.mux.Lock()
e.notifyAckUnlocked(msgID)
fn, ok := e.rpc[msgID]
e.mux.Unlock()
if !ok {