1
0
mirror of https://github.com/go-kratos/kratos.git synced 2025-02-03 13:11:42 +02:00
2019-09-09 10:56:22 +08:00
..
2019-05-08 10:55:32 +08:00
2019-05-08 10:55:32 +08:00
2019-09-09 10:56:22 +08:00
2019-09-09 10:56:22 +08:00
2019-05-08 10:55:32 +08:00

pkg/sync/pipeline/fanout

功能:

  • 支持定义Worker 数量的goroutine,进行消费
  • 内部支持的元数据传递(pkg/net/metadata)

示例:

//名称为cache 执行线程为1 buffer长度为1024
cache := fanout.New("cache", fanout.Worker(1), fanout.Buffer(1024))
cache.Do(c, func(c context.Context) { SomeFunc(c, args...) })
cache.Close()