github.com/yandex/pandora@v0.5.32/core/schedule/once.go (about) 1 package schedule 2 3 import ( 4 "time" 5 6 "github.com/yandex/pandora/core" 7 ) 8 9 // NewOnce returns schedule that emits all passed operation token at start time. 10 // That is, is schedule for zero duration, unlimited RPS, and n operations. 11 func NewOnce(n int64) core.Schedule { 12 return NewDoAtSchedule(0, n, func(i int64) time.Duration { 13 return 0 14 }) 15 } 16 17 type OnceConfig struct { 18 Times int64 `validate:"min=1"` // N is decoded like bool 19 } 20 21 func NewOnceConf(conf OnceConfig) core.Schedule { 22 return NewOnce(conf.Times) 23 }