test(nodes): isolate RPC timeout from queue expiry

This commit is contained in:
Hamed Sanaei
2026-11-30 23:24:56 +03:30
parent 4e0fb882bf
commit 93ca012ee4
@@ -38,13 +38,16 @@ func (r *blockedClientPushRuntime) AddClient(ctx context.Context, _ *model.Inbou
return nil
}
if r.waitForTimeout {
select {
case <-ctx.Done():
r.expired.Store(errors.Is(ctx.Err(), context.DeadlineExceeded))
return ctx.Err()
case <-time.After(nodeClientPushTimeout + 2*time.Second):
if deadline, ok := ctx.Deadline(); !ok || time.Until(deadline) > nodeClientPushTimeout {
return errors.New("push timeout was not enforced")
}
// Give the node a shorter deadline so this case exercises RPC ordering
// and the queue-expiry regression can test the separate wait budget.
call, cancel := context.WithTimeout(ctx, nodeClientPushTimeout/2)
defer cancel()
<-call.Done()
r.expired.Store(errors.Is(call.Err(), context.DeadlineExceeded))
return call.Err()
}
select {
case <-r.release: