What happens in Quartz.NET/Quartz when

... when the job is still in progress, when is its next run time?

For example, if I have a task that happens every 30 seconds, and after 30 seconds it still works, will the next instance be turned on or will it wait?

+1
source share
2 answers

The short answer is that a new task will be executed if you do not inherit from IStatefulJob, in which case only one instance of the task can be launched at a time.

+2
source

TskTsk, IStatefulJob insted IJob, ! , 30 ( , ), ! , , SimpleTrigger. GetFireTimeAfter.

public class MyTrigger : SimpleTrigger
{

    public MyTrigger(string name,
                     string group,
                     DateTime startTimeUtc,
                     DateTime? endTimeUtc,
                     int repeatCount,
                     TimeSpan repeatInterval) : base(name, startTimeUtc, endTimeUtc, repeatCount, repeatInterval)
    {
    }

    public override DateTime? GetFireTimeAfter(DateTime? afterTimeUtc)
    {
        return DateTime.UtcNow.AddSeconds(RepeatInterval.TotalSeconds);
    }

}

, .

+2

Source: https://habr.com/ru/post/1786676/


All Articles