Implement centralized scheduling for recurring tasks #553
Labels
architecture
component/api-server
p1
Critical bugs that prevent DT from being used, or features that must be implemented ASAP
size/L
High effort
Recurring tasks are currently scheduled in every instance of the API server, in
TaskScheduler
, using simpleTimer
s behind the scenes.We need to scale the API server to multiple instances (#375), but this will be problematic when every instance schedules redundant tasks. As per #375 (comment), as a short- to mid-term solution, tasks should be triggerable via REST API endpoint.
Once the endpoints are available, tasks can be scheduled via
CronJob
. TheCronJob
s merelycurl
an API server endpoint to trigger tasks. Requests are made against the k8s service of the API server.CronJob
supports various settings for retry, backoff and timeouts. To leverage these functionalities, API endpoints must block as long as the respective task is running.To prevent certain heavy tasks (e.g. portfolio metrics update) from being executed concurrently, a locking mechanism must be used. Usage of https://github.com/lukas-krecan/ShedLock should be investigated.
The text was updated successfully, but these errors were encountered: