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.63k stars 243 forks source link

RunOnceAtStart sometimes it doesn't work. #353

Open Kerwin1202 opened 5 months ago

Kerwin1202 commented 5 months 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 3 months ago

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