mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-23 22:11:09 +03:00
Changed scheduleJob method signature to take when parameter first
no issue - Accepting the schedule or a data when scheduled job should be run would follow a signature used in other established frameworks: (1) https://github.com/mperham/sidekiq/wiki/Ent-Periodic-Jobs#definition - Another reason to put scheduling parameter first is this would allow leaving an optional "data" parameter as last
This commit is contained in:
parent
9abbe60e10
commit
ae4f35ddd8
@ -44,11 +44,11 @@ class JobManager {
|
|||||||
/**
|
/**
|
||||||
* Schedules recuring job
|
* Schedules recuring job
|
||||||
*
|
*
|
||||||
* @param {Function|String} job - function or path to a file defining a job
|
|
||||||
* @param {Object} data - data to be passed into the joba
|
|
||||||
* @param {String} when - cron or human readable schedule format
|
* @param {String} when - cron or human readable schedule format
|
||||||
|
* @param {Function|String} job - function or path to a file defining a job
|
||||||
|
* @param {Object} data - data to be passed into the job
|
||||||
*/
|
*/
|
||||||
scheduleJob(job, data, when) {
|
scheduleJob(when, job, data) {
|
||||||
let schedule;
|
let schedule;
|
||||||
|
|
||||||
schedule = later.parse.text(when);
|
schedule = later.parse.text(when);
|
||||||
|
@ -17,7 +17,7 @@ describe('Job Manager', function () {
|
|||||||
const jobManager = new JobManager();
|
const jobManager = new JobManager();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
jobManager.scheduleJob(() => {}, {}, 'invalid expression');
|
jobManager.scheduleJob('invalid expression', () => {}, {});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
err.message.should.equal('Invalid schedule format');
|
err.message.should.equal('Invalid schedule format');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user