dotnet-labs / ServiceWorkerCronJob

Schedule Cron Jobs using HostedService in ASP.NET Core
MIT License
265 stars 71 forks source link

Schedule runs at every 15 mins but scheduled to run at specific time #2

Closed santhitvnl closed 4 years ago

santhitvnl commented 4 years ago

Hi, I followed this library and the codeburst which schedules and runs just fine but I have below issue with it.

When I run my Asp.Net Core Web APIin Windows 10 environments everything works as scheduled whereas the same same Web Apiwhen I deploy in Windows Server Core, this schedule runs at every 15 mins.

Should I change any thing in the code?

Here is my options at startup.cs.

services.AddCronJob<BackUpDBService>(c =>
            { // Currently it is running for every 15 mins in server which is wrong.
                c.TimeZoneInfo = TimeZoneInfo.Local;
                c.CronExpression = @"0 3 * * *";
            });
changhuixu commented 4 years ago

I have a similar job on server running at early morning every day, and it works. However, from your description, I am not able to determine what's wrong. Could you add some logging in the ScheduleJob method? So that you can verify the time of the next_occurrence and the time of delay.

santhitvnl commented 4 years ago

@changhuixu , Thanks for comment. This library is just amazing when we needed to create many schedule jobs.

I just realized that this issue is not related with this library but with some other third party tool that I use in my code. Hence closing this. Thanks you.