Documentation ¶
Overview ¶
Example ¶
package main import ( "context" "fmt" "github.com/donutloop/toolkit/schedule" ) func main() { s := schedule.NewFIFOScheduler() defer s.Stop() job := func(ctx context.Context) { fmt.Println("create db entry") } if err := s.Schedule(job); err != nil { fmt.Printf("error: (%v) \n", err) } s.WaitFinish(1) }
Output: create db entry
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrStoppedScheduler error = errors.New("schedule: schedule to stopped scheduler")
Functions ¶
This section is empty.
Types ¶
type DebugStack ¶
type DebugStack []byte
type Fifo ¶
type Fifo struct { PanicHandler func(DebugStack) // contains filtered or unexported fields }
func NewFIFOScheduler ¶
func NewFIFOScheduler() *Fifo
NewFIFOScheduler returns a Scheduler that schedules jobs in FIFO order sequentially.
func (*Fifo) WaitFinish ¶
Click to show internal directories.
Click to hide internal directories.