I am planning to run the Anvil app server locally (selfhosted).
I need a background job that queries a mssql database every 5 seconds. Just to clearify, it shall work independently from the client side code, it shall only run on server side.
Is this solvable without anvil uplink?
If yes, how can this be achieved (in general)?
If the way forward is anvil uplink, it will run on the same machine as the anvil app server. I just found it counter productive
Although a minor issue here is that Scheduled Tasks require a minimum interval of 1 minute
But if you want to still do it for every 5 seconds, there is a hack that may work.
Just schedule that task for every minute. In that task, create an infinite loop with sleep for 5 seconds. That task will be running continuously for a long time (Usually a week or two). After that time, when it vanishes, it will be restarted within a minute.
Interesting solution, but I have a followup question; if the scheduled task runs every minute, will it spawn a new task every minute even if I have a sleep method inside the task?