jamesmh / coravel

Near-zero config .NET library that makes advanced application features like Task Scheduling, Caching, Queuing, Event Broadcasting, and more a breeze!
https://docs.coravel.net/Installation/
MIT License
3.92k stars 257 forks source link

RunOnceAtStart sometimes it doesn't work. #353

Open Kerwin1202 opened 1 year ago

Kerwin1202 commented 1 year ago

Describe the bug

    scheduler.Schedule<Service>()
        .Cron("30 */2 * * *")
        .RunOnceAtStart()
        .Zoned(TimeZoneInfo.Local);

    scheduler.ScheduleAsync(async () =>
        {
             Console.WriteLine("Start refresh data");
           // ... other code 
        })
        .DailyAtHour(9)
        .RunOnceAtStart()
        .Zoned(TimeZoneInfo.Local);
public class Service : IInvocable
{
   ......  other code
    public async Task Invoke()
    {
        _logger. Information($"Start login {_config. UserName}");
        await Login();
    }
   ......  other code
}

Affected Coravel Feature Scheduling

Expected behaviour Output content immediately when starting the program. ( "Start login xxx" and "Start refresh data") , but when I run it many times, sometimes it does not output content, and the console does not report any error message.

run windows service. .net core 7.0 coravel : 5.0.2.0

arteny commented 9 months ago

Not works for me in .net 8 with ScheduleAsync as well

chris-rp commented 2 months ago

This is still an issue in .net8, coravel 5.0.4

Anything new on this issue?

jamesmh commented 2 months ago

No news on this yet. Will look to investigate soon. Not sure what's going on at first glance. Unless someone else has any idea by looking at the source?