elsa-workflows / elsa-core

A .NET workflows library
https://v3.elsaworkflows.io/
MIT License
6.49k stars 1.2k forks source link

[BUG]Timing trigger exception. #5883

Open clown599 opened 3 months ago

clown599 commented 3 months ago

Description

Triggering the workflow every second via Cron or Timer can lead to repetitive workflow triggering and confusing timing.

Steps to Reproduce

CRON(0/1 ?)->A time-consuming custom activity

Expected Behavior

Triggered once per second according to the expression or after the first real column workflow has completed execution, then triggered the second workflow.

Actual Behavior

A second or even more workflows are triggered during the execution of the first workflow instance

Screenshots

image

Environment

Log Output

No error logging output

Troubleshooting Attempts

When the execution time of a custom activity (which is a time-consuming activity) is controlled within the trigger interval or the trigger time is set beyond the activity execution time, the abnormal workflow real column will be greatly reduced or even no.

clown599 commented 3 months ago

This setting does not appear to be working. image

sfmskywalker commented 3 months ago

@clown599 If I understand correctly, everything works as expected, except for the Singleton setting, is that right?

clown599 commented 3 months ago

@sfmskywalker no. None of the above Settings work. And the trigger cycle is not expected. Refer to the image above, I set it to trigger once a second, cron expression is: 0/1 ? But the actual trigger time is not one second.

sfmskywalker commented 3 months ago

Got it. So none of the Activation strategy settings work, and the cron trigger doesn't trigger every one second, but it does trigger regularly.

clown599 commented 3 months ago

Yes.

  1. There is no specific average trigger time. Sometimes it takes several seconds or even more than 10 seconds to trigger, and sometimes it triggers multiple times a second. The activity is triggered as expected only if the execution time is less than the trigger interval. 2, tried the default Settings and Quartz.NET, both have this problem.

Quartz.NET I set it up like this: image

clown599 commented 3 months ago

@sfmskywalker Follow these image steps to reproduce it:: image image image