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

Scheduler does not run until WEB API server receives its first HTTP Request #388

Open amande4x opened 1 month ago

amande4x commented 1 month ago

I have scheduled my scheduler to run every 1 minute. But after I deploy by server and recycle my app-pool, scheduler does not run. It only starts running when it receives first HHTP request from UI front end. How can i overcome this dependency?

jamesmh commented 1 week ago

Are you using IIS? Which version? Which version of .NET?

amande4x commented 1 week ago

IIS - Version 10, .NET 8. I would appreciate it, if you can you please prioritize this issue? It's causing significant problems for my client.

srivastava-prashant commented 1 week ago

We too are facing issue, I see - until you launch the application and it makes first API call Coravel's Scheduler does not even initiate. The problem we face here is - If you have frequent release for product. And, you mostly prefer to deploy during Off business hours.

Then, in that case unless we explicit browse the application that would not trigger. And, If no one launch the application for a while post release then it would potentially impact the system. Because, there could be data which your system was expecting but it won't come through as the Coravel's Scheduler has even initated.

jamesmh commented 1 week ago

Check out these closed issues that should help:

Check out these articles linked by the issues:

srivastava-prashant commented 1 week ago

Check out these closed issues that should help:

Check out these articles linked by the issues:

Per this link (https://www.taithienbo.com/how-to-auto-start-and-keep-an-asp-net-core-web-application-and-keep-it-running-on-iis/) it seems that we would need to set the .NET CLR to .net 4.
But, our API is in .NET 8. And for .NET core based project Microsoft guidelines are to use "No Managed Code" in .NET CLR ( https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/advanced?view=aspnetcore-8.0 )

Can we safely ignore this NET CLR option and continue to be "No Managed Code" ?

image image
jamesmh commented 5 days ago

Not sure, it's been a few years since I've touched IIS. My best advice is to try the non CLR approach and see if you get the relevant options in IIS? Try testing in a dev environment to see if things work out.