From 8a862dfd067e955f0c6b388872897d5690ce6c89 Mon Sep 17 00:00:00 2001 From: youngxhui Date: Wed, 15 Jun 2022 21:00:54 +0800 Subject: [PATCH] fix error --- README.md | 2 ++ runjob.go | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 9cd73cc..ec8ba88 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # ![](https://raw.githubusercontent.com/bamzi/jobrunner/master/views/runclock.jpg) JobRunner +[![Go](https://github.com/youngxhui/jobrunner/actions/workflows/go.yml/badge.svg)](https://github.com/youngxhui/jobrunner/actions/workflows/go.yml) + JobRunner is framework for performing work asynchronously, outside of the request flow. It comes with cron to schedule and queue job functions for processing at specified time. It includes a live monitoring of current schedule and state of active jobs that can be outputed as JSON or Html template. diff --git a/runjob.go b/runjob.go index 6204959..73943f5 100644 --- a/runjob.go +++ b/runjob.go @@ -30,21 +30,21 @@ func Schedule(spec string, job cron.Job, n ...string) error { if err != nil { return err } - MainCron.Schedule(sched, New(job, ...n)) + MainCron.Schedule(sched, New(job, n...)) return nil } // Run the given job at a fixed interval. // The interval provided is the time between the job ending and the job being run again. // The time that the job takes to run is not included in the interval. -func Every(duration time.Duration, job cron.Job) { +func Every(duration time.Duration, job cron.Job, n ...string) { - MainCron.Schedule(cron.Every(duration), New(job)) + MainCron.Schedule(cron.Every(duration), New(job, n...)) } // Run the given job right now. -func Now(job cron.Job, n ...string) { - go New(job, n).Run() +func Now(job cron.Job) { + go New(job).Run() } // Run the given job once, after the given delay.