v0.0.1
This commit is contained in:
16
src/worker.go
Normal file
16
src/worker.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
func createWorker(interval time.Duration, task func()) {
|
||||
go func() {
|
||||
ticker := time.NewTicker(interval)
|
||||
defer ticker.Stop()
|
||||
|
||||
for range ticker.C {
|
||||
task()
|
||||
}
|
||||
}()
|
||||
}
|
||||
Reference in New Issue
Block a user