Fix: make selector react immediately

This commit is contained in:
Dreamacro
2020-04-30 20:13:27 +08:00
parent 7d51ab5846
commit 94e0e4b000
3 changed files with 22 additions and 2 deletions

View File

@ -50,6 +50,10 @@ func (s *Single) Do(fn func() (interface{}, error)) (v interface{}, err error, s
return call.val, call.err, false
}
func (s *Single) Reset() {
s.last = time.Time{}
}
func NewSingle(wait time.Duration) *Single {
return &Single{wait: wait}
}