实现代码
package cas
import (
"time"
"clustertech.com/chess/ng/sysconf"
"github.com/sirupsen/logrus"
)
var (
log3 = log.WithFields(logrus.Fields{
"goroutine": "sync_cas_job_clean",
})
)
package main
import (
"fmt"
"time"
)
func main() {
ch1 := make(chan bool)
go func(interval, expire int) {
fmt.Printf("Start CAS sync_cas_job_clean routine.Exec interval is : %d, expire time is : %d.\n",
interval, expire)
intervals := time.Duration(interval)
tick := time.Tick(intervals * 5 * time.Second)
for range tick {
fmt.Printf("Begin to clean job records...")
}
ch1 <- true
}(1, 30)
<- ch1
}
测试结果
