RikkiGibson/Corvallis-Bus-Server

Automatically run the init task at regular intervals

Closed this issue · 3 comments

It's necessary for the long-term maintainability of this service for the init task to run automatically when transit data changes. We need to make that happen. It may be a matter of dispatching a task in the background when the first request of a given day comes in. Route info changes a bit in advance of when the changes in service occur, so it's unlikely to misinform that particular user who kicked off the re-run of the task.

I'd suggest running a Windows Service which makes a request to the init route every X days, having that run on Gearhost somehow.

I had some weird process involving setting an expiry time for an HTTP cache item and handling the invalidate event to re-run the init task. I thiiink it was working, but I'll really want some kind of logging in order to check with some confidence that yes, the init task really did run at 4 AM or whenever that morning. Need another solution for the new ASP.NET Core 2/Azure App Service stack.

This can be done with an Azure Function on a Timer Trigger