fix(plugin-workflow): fix schedule trigger number type repeat (#1475)
This commit is contained in:
parent
6dbff4f74c
commit
1705b10b98
@ -51,12 +51,12 @@ ScheduleModes.set(SCHEDULE_MODE.CONSTANT, {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (repeat) {
|
if (repeat) {
|
||||||
if (typeof repeat === 'number'
|
if (typeof repeat === 'number') {
|
||||||
&& repeat > this.cacheCycle
|
const next = timestamp - (timestamp - startTime) % repeat + repeat;
|
||||||
&& (timestamp - startTime) % repeat > this.cacheCycle
|
if (next <= timestamp || next > timestamp + this.cacheCycle) {
|
||||||
) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (endsOn) {
|
if (endsOn) {
|
||||||
const endTime = parseDateWithoutMs(endsOn);
|
const endTime = parseDateWithoutMs(endsOn);
|
||||||
@ -77,7 +77,6 @@ ScheduleModes.set(SCHEDULE_MODE.CONSTANT, {
|
|||||||
const timestamp = now.getTime();
|
const timestamp = now.getTime();
|
||||||
// NOTE: align to second start
|
// NOTE: align to second start
|
||||||
const startTime = parseDateWithoutMs(startsOn);
|
const startTime = parseDateWithoutMs(startsOn);
|
||||||
|
|
||||||
if (!startTime || startTime > timestamp) {
|
if (!startTime || startTime > timestamp) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -498,7 +497,7 @@ export default class ScheduleTrigger extends Trigger {
|
|||||||
const should = await this.shouldCache(workflow, now);
|
const should = await this.shouldCache(workflow, now);
|
||||||
|
|
||||||
if (should) {
|
if (should) {
|
||||||
console.log('caching schedule workflow:', workflow.id);
|
this.plugin.app.logger.info('caching scheduled workflow will run in next minute:', workflow.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setCache(workflow, !should);
|
this.setCache(workflow, !should);
|
||||||
|
Loading…
Reference in New Issue
Block a user