pe.go 294 B

123456789101112131415161718
  1. package main
  2. import (
  3. "fmt"
  4. "time"
  5. "github.com/tal-tech/go-zero/core/executors"
  6. )
  7. func main() {
  8. executor := executors.NewBulkExecutor(func(items []interface{}) {
  9. fmt.Println(len(items))
  10. }, executors.WithBulkTasks(10))
  11. for {
  12. executor.Add(1)
  13. time.Sleep(time.Millisecond * 90)
  14. }
  15. }