mirror of
https://github.com/Icinga/icingadb.git
synced 2026-05-28 04:35:54 -04:00
Return ctx.Err() on ctx.Done()
This commit is contained in:
parent
5e473e8b37
commit
0ec2b6ca60
4 changed files with 8 additions and 6 deletions
|
|
@ -50,7 +50,7 @@ func (b *Bulker) run(ch <-chan contracts.Entity, count int) {
|
|||
|
||||
bufCh <- v
|
||||
case <-ctx.Done():
|
||||
return nil
|
||||
return ctx.Err()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
@ -74,7 +74,7 @@ func (b *Bulker) run(ch <-chan contracts.Entity, count int) {
|
|||
case <-timeout:
|
||||
drain = false
|
||||
case <-ctx.Done():
|
||||
return nil
|
||||
return ctx.Err()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ func (d Driver) Open(dsn string) (c driver.Conn, err error) {
|
|||
select {
|
||||
case <-ctx.Done():
|
||||
// Context canceled.
|
||||
return
|
||||
return nil, ctx.Err()
|
||||
case <-time.After(sleep):
|
||||
// Wait for backoff duration and continue.
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ func (delta *Delta) start(ctx context.Context, actualCh, desiredCh <-chan contra
|
|||
|
||||
cnt.Inc()
|
||||
case <-ctx.Done():
|
||||
return nil
|
||||
return ctx.Err()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
@ -116,7 +116,7 @@ func (delta *Delta) start(ctx context.Context, actualCh, desiredCh <-chan contra
|
|||
|
||||
cnt.Inc()
|
||||
case <-ctx.Done():
|
||||
return nil
|
||||
return ctx.Err()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -30,7 +30,9 @@ func WithBackoff(ctx context.Context, retryableFunc RetryableFunc, retryable IsR
|
|||
select {
|
||||
case <-ctx.Done():
|
||||
// Context canceled. Return last known error.
|
||||
// TODO(el): Return ctx.Err() if err is nil?
|
||||
if err == nil {
|
||||
err = ctx.Err()
|
||||
}
|
||||
return
|
||||
case <-time.After(sleep):
|
||||
// Wait for backoff duration and continue.
|
||||
|
|
|
|||
Loading…
Reference in a new issue