mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
fn: cancellations in WaitAsyncResource (#694)
* fn: cancellations in WaitAsyncResource Added go context with cancel to wait async resource. Although today, the only case for cancellation is shutdown, this cleans up agent shutdown a little bit. * fn: locked broadcast to avoid missed wake-ups * fn: removed ctx arg to WaitAsyncResource and startDequeuer This is confusing and unnecessary.
This commit is contained in:
@@ -112,13 +112,15 @@ func (a *slotQueue) ejectSlot(s *slotToken) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (a *slotQueue) startDequeuer(ctx context.Context) (chan *slotToken, context.CancelFunc) {
|
||||
func (a *slotQueue) startDequeuer() (chan *slotToken, context.CancelFunc) {
|
||||
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
|
||||
myCancel := func() {
|
||||
cancel()
|
||||
a.cond.L.Lock()
|
||||
a.cond.Broadcast()
|
||||
a.cond.L.Unlock()
|
||||
}
|
||||
|
||||
output := make(chan *slotToken)
|
||||
|
||||
Reference in New Issue
Block a user