mirror of
https://github.com/strapi/strapi.git
synced 2025-07-30 20:39:05 +00:00
Change removal logic
This commit is contained in:
parent
680b53c29b
commit
046535397a
@ -28,8 +28,8 @@ const createCronService = () => {
|
||||
|
||||
const fnWithStrapi = (...args) => fn({ strapi }, ...args);
|
||||
|
||||
const job = new Job(null, fnWithStrapi);
|
||||
jobsSpecs.push({ job, options });
|
||||
const job = new Job(taskValue.name || null, fnWithStrapi);
|
||||
jobsSpecs.push({ job, options, name: taskValue.name });
|
||||
|
||||
if (running) {
|
||||
job.schedule(options);
|
||||
@ -38,9 +38,9 @@ const createCronService = () => {
|
||||
return this;
|
||||
},
|
||||
remove(name) {
|
||||
const matchingJobsSpecs = jobsSpecs.filter(({ options }) => options.name === name);
|
||||
const matchingJobsSpecs = jobsSpecs.filter(({ name: jobSpecName }) => jobSpecName === name);
|
||||
matchingJobsSpecs.forEach(({ job }) => job.cancel());
|
||||
jobsSpecs = jobsSpecs.filter(({ options }) => options.name !== name);
|
||||
jobsSpecs = jobsSpecs.filter(({ name: jobSpecName }) => jobSpecName !== name);
|
||||
return this;
|
||||
},
|
||||
start() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user