You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
354 B
Go
23 lines
354 B
Go
8 years ago
|
package wray
|
||
|
|
||
|
import "time"
|
||
|
|
||
|
type Schedular interface {
|
||
|
wait(time.Duration, func())
|
||
|
delay() time.Duration
|
||
|
}
|
||
|
|
||
|
type ChannelSchedular struct {
|
||
|
}
|
||
|
|
||
|
func (self ChannelSchedular) wait(delay time.Duration, callback func()) {
|
||
|
go func() {
|
||
|
time.Sleep(delay)
|
||
|
callback()
|
||
|
}()
|
||
|
}
|
||
|
|
||
|
func (self ChannelSchedular) delay() time.Duration {
|
||
|
return (1 * time.Minute)
|
||
|
}
|