mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-16 07:16:38 +00:00
[management] revert ctx dependency in get account with backpressure (#5878)
(cherry picked from commit 7f666b8022)
This commit is contained in:
@@ -63,20 +63,11 @@ func (ac *AccountRequestBuffer) GetAccountWithBackpressure(ctx context.Context,
|
|||||||
|
|
||||||
log.WithContext(ctx).Tracef("requesting account %s with backpressure", accountID)
|
log.WithContext(ctx).Tracef("requesting account %s with backpressure", accountID)
|
||||||
startTime := time.Now()
|
startTime := time.Now()
|
||||||
|
ac.getAccountRequestCh <- req
|
||||||
|
|
||||||
select {
|
result := <-req.ResultChan
|
||||||
case <-ctx.Done():
|
log.WithContext(ctx).Tracef("got account with backpressure after %s", time.Since(startTime))
|
||||||
return nil, ctx.Err()
|
return result.Account, result.Err
|
||||||
case ac.getAccountRequestCh <- req:
|
|
||||||
}
|
|
||||||
|
|
||||||
select {
|
|
||||||
case <-ctx.Done():
|
|
||||||
return nil, ctx.Err()
|
|
||||||
case result := <-req.ResultChan:
|
|
||||||
log.WithContext(ctx).Tracef("got account with backpressure after %s", time.Since(startTime))
|
|
||||||
return result.Account, result.Err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ac *AccountRequestBuffer) processGetAccountBatch(ctx context.Context, accountID string) {
|
func (ac *AccountRequestBuffer) processGetAccountBatch(ctx context.Context, accountID string) {
|
||||||
|
|||||||
Reference in New Issue
Block a user