github.com/songzhibin97/gkit@v1.2.13/delayed/option.go (about) 1 package delayed 2 3 import ( 4 "github.com/songzhibin97/gkit/options" 5 "os" 6 "time" 7 ) 8 9 // SetCheckTime 设置检查时间 10 func SetCheckTime(checkTime time.Duration) options.Option { 11 return func(o interface{}) { 12 o.(*DispatchingDelayed).checkTime = checkTime 13 } 14 } 15 16 // SetWorkerNumber 设置并发数 17 func SetWorkerNumber(w int64) options.Option { 18 return func(o interface{}) { 19 o.(*DispatchingDelayed).Worker = w 20 } 21 } 22 23 // SetSingle 设置监控信号 24 func SetSingle(signal ...os.Signal) options.Option { 25 return func(o interface{}) { 26 o.(*DispatchingDelayed).signal = signal 27 } 28 } 29 30 // SetSingleCallback 设置监控信号回调 31 func SetSingleCallback(callback func(signal os.Signal, d *DispatchingDelayed)) options.Option { 32 return func(o interface{}) { 33 o.(*DispatchingDelayed).signalCallback = callback 34 } 35 }