Hi,
I must be doing something wrong and trying to understand what exactly.
So I have a simple recurrent job updated on startup (ASP .NET Core hosted on Azure) in the following way:
recurringJobManager.AddOrUpdate(Id, Job.FromExpression<IDispatcherService>(s => s.RunAsync()), cronExpression, DateTimeHelper.MoscowTimeZoneInfo);
The cronExpression
is normally Cron.Daily(16, 30);
but sometimes I change it to another time and deploy the project. Immediately after startup the job gets executed and it doesn’t update the NextExecution
field so I have to manually disable Hangfire to avoid double execution.
I’ve just tried to update the NextExecution
field manually by setting a point in future and had the job immediately executed as well.
What am I doing wrong? I only want the job to be executed at a specific point in time rather than being affected by site deployment/startup/updating Cron expression etc.
Thanks in advance.