fix(plugin-workflow): fix schedule duplicated triggering in multi-apps (#2313)

This commit is contained in:
Junyi 2023-07-25 09:41:54 +07:00 committed by GitHub
parent d8befa75c6
commit df4e6de4dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -424,6 +424,10 @@ export default class ScheduleTrigger extends Trigger {
} }
init() { init() {
if (this.plugin.app.name !== 'main') {
return;
}
if (this.timer) { if (this.timer) {
return; return;
} }
@ -435,7 +439,7 @@ export default class ScheduleTrigger extends Trigger {
this.run, this.run,
// NOTE: // NOTE:
// try to align to system time on each second starts, // try to align to system time on each second starts,
// after at least 1 second initialized for anything to get ready. // after at least 1 second initialized for everything to get ready.
// so jobs in 2 seconds will be missed at first start. // so jobs in 2 seconds will be missed at first start.
1_000 - now.getMilliseconds(), 1_000 - now.getMilliseconds(),
); );