@VisibleForTesting protected void tick() { LongTaskTimer timer = registry.longTaskTimer(timerId); long timerId = timer.start(); log.info("Starting cleanup"); try { executionRepository.retrieveAllApplicationNames(ORCHESTRATION, threshold).forEach(app -> { log.info("Cleaning up orchestration executions (application: {}, threshold: {})", app, threshold); ExecutionCriteria executionCriteria = new ExecutionCriteria(); executionCriteria.setPageSize(Integer.MAX_VALUE); cleanup(executionRepository.retrieveOrchestrationsForApplication(app, executionCriteria), app, "orchestration"); }); } catch (Exception e) { log.error("Cleanup failed", e); } finally { timer.stop(timerId); } }