mirror of
https://github.com/yusing/godoxy.git
synced 2026-02-23 02:44:52 +01:00
23 lines
404 B
Go
23 lines
404 B
Go
package idlewatcher
|
|
|
|
import "context"
|
|
|
|
func (w *Watcher) cancelled(reqCtx context.Context) bool {
|
|
select {
|
|
case <-reqCtx.Done():
|
|
w.l.Debug().AnErr("cause", context.Cause(reqCtx)).Msg("wake canceled")
|
|
return true
|
|
default:
|
|
return false
|
|
}
|
|
}
|
|
|
|
func (w *Watcher) waitStarted(reqCtx context.Context) bool {
|
|
select {
|
|
case <-reqCtx.Done():
|
|
return false
|
|
case <-w.route.Started():
|
|
return true
|
|
}
|
|
}
|