Skip to content

Instantly share code, notes, and snippets.

@flier
Last active December 21, 2015 14:32
type BaseScehduler interface {
// Create a new periodic job
Every(interval uint64) *Job
// Create a one time job
After(interval uint64) *Job
// Remove specific job j
Cancel(*Job) bool
// Run all the jobs that are scheduled to run.
RunPending()
// Start starts the scheduler
Start()
// IsRunning returns true if the job has started
IsRunning() bool
// Stop stops the scheduler from executing jobs
Stop()
// Delete all scheduled jobs
Clear()
}
type Scheduler interface {
BaseScehduler
// Location sets the default location of every job created with `Every`.
// The deefault location is `time.Local`
Location(*time.Location)
// NextRun returns the next next job to be run and the time in which it will be run
NextRun() (*Job, time.Time)
// RunAll runs all of the jobs regardless of wether or not they are pending
RunAll()
// RunAllWithDelay runs all of the jobs regardless of wether or not they are pending with a delay
RunAllWithDelay(time.Duration)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment