Peter
04/22/2022, 4:47 PMval pollingContext = Executors.newSingleThreadExecutor().asCoroutineDispatcher()
withContext(pollingContext) {
...
}
Anyone any ideas? Thanks!ashmelev
04/22/2022, 6:52 PMThread.sleep(100)
(or similar) into your processing loop. Then call that task from an ExecutorPool. This will allow the vCPU some cycles with which to respond to health checks
2.) Completely remove that task to a different container and kick it off from the main service with an asynch message (or simply move the entire @Scheduled) there. Then you can adjust the health check for this long-running process as needed. I've moved such loads to dedicated EC2 instances (in AWS) and monitored them separately from the Kubernetes cluster (in the instance the process might run for 18-24 hours)
3.) If you are hosted in Kubernetes then by far the bast alternative is a Job/CronJob mechanism
https://kubernetes.io/docs/concepts/workloads/controllers/job/
https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/
Kubernetes deals with those differently (TTL vs "liveness" check) so they are better suited to the problem