mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-02 23:45:11 +03:00
test(nodes): isolate RPC timeout from queue expiry
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user