Files
go-zero/example/periodicalexecutor/pe.go

19 lines
292 B
Go
Raw Normal View History

2020-07-26 17:09:05 +08:00
package main
import (
2020-08-11 12:44:21 +08:00
"fmt"
2020-07-26 17:09:05 +08:00
"time"
2020-08-08 16:40:10 +08:00
"github.com/tal-tech/go-zero/core/executors"
2020-07-26 17:09:05 +08:00
)
func main() {
exeutor := executors.NewBulkExecutor(func(items []interface{}) {
2020-08-11 12:44:21 +08:00
fmt.Println(len(items))
2020-07-26 17:09:05 +08:00
}, executors.WithBulkTasks(10))
for {
exeutor.Add(1)
time.Sleep(time.Millisecond * 90)
}
}