Example #1
0
func CreateJobsRoutes(r martini.Router) {
	jobrunner.Start() // optional: jobrunner.Start(pool int, concurrent int) (10, 1)
	jobrunner.Schedule("@every 5s", ReminderEmails{})
	jobrunner.Schedule("@every 10s", ReminderEmails{})
	entries := jobrunner.Entries()
	fmt.Println(entries[len(entries)-1].ID)
	r.Get("/status", requestJobs)
}
Example #2
0
func InitCron() {
	jobrunner.Start()

	err := jobrunner.Schedule("@every 1h", WorkerHourlyLog{"WorkerHourlyLog"})
	logger.PanicfIfError(err, "Error while scheduling Worker HourlyLog, %s", err)
	err = jobrunner.Schedule("@every 15m", WorkerAccountName{"WorkerAccountName"})
	logger.PanicfIfError(err, "Error while scheduling Worker AccountName, %s", err)
	err = jobrunner.Schedule("@every 15m", WorkerDistinctName{"WorkerDistinctName"})
	logger.PanicfIfError(err, "Error while scheduling Worker DistinctName, %s", err)
	logger.Info("All the workers are Initialize")
}
Example #3
0
func (c Clock) Schedule(name string, eventHandler agent.EventHandler) {
	log.Info("registering new cron job: %s", name)
	job := Job{eventHandler}

	jobrunner.Start()
	jobrunner.Schedule(c.Interval, job)
}
Example #4
0
func (s schedule) Schedule(rate string, f interface{}) schedule {
	jobrunner.Schedule("@every 10s", Jobs(f.(func())))
	return s
}