mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 09:47:10 +00:00
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 (typeof repeat === 'number'
|
||||
&& repeat > this.cacheCycle
|
||||
&& (timestamp - startTime) % repeat > this.cacheCycle
|
||||
) {
|
||||
if (typeof repeat === 'number') {
|
||||
const next = timestamp - (timestamp - startTime) % repeat + repeat;
|
||||
if (next <= timestamp || next > timestamp + this.cacheCycle) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (endsOn) {
|
||||
const endTime = parseDateWithoutMs(endsOn);
|
||||
@ -77,7 +77,6 @@ ScheduleModes.set(SCHEDULE_MODE.CONSTANT, {
|
||||
const timestamp = now.getTime();
|
||||
// NOTE: align to second start
|
||||
const startTime = parseDateWithoutMs(startsOn);
|
||||
|
||||
if (!startTime || startTime > timestamp) {
|
||||
return;
|
||||
}
|
||||
@ -498,7 +497,7 @@ export default class ScheduleTrigger extends Trigger {
|
||||
const should = await this.shouldCache(workflow, now);
|
||||
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user