<@ULVA73B9P> when I create a Deployment with an In...
# ask-marvin
d
@Marvin when I create a Deployment with an IntervalSchedule of 5 minutes, how do I ensure that scheduled runs will always run? For example, if I stop the scheduler service than turn it back on 20 minutes later, it won't run any of the previous flow runs that should've executed during that 20 minute window.
m
To ensure that scheduled runs always execute, including catching up with runs missed during downtime (such as when the scheduler service is stopped), you will need to make sure that the scheduler is configured to create runs for past scheduled times that have not executed yet. Prefect doesn't seem to have a built-in feature for "catch up" execution for missed runs due to the scheduler service being off. However, Prefect's scheduler by default creates the next three runs for typical deployments, and this happens on a 60-second loop for recently-modified deployments. While this does not directly answer the question of executing missed runs, it does mean that the scheduler will quickly re-evaluate schedules once the service restarts. Depending on your specific requirements, you may need to handle the catch-up logic manually or use a custom script to inspect the expected schedule versus executed runs and enqueue missed runs on service restoration. For more details on how Prefect's scheduler handles scheduling, you can refer to the Prefect Schedules documentation: - Prefect Schedules If you have specific needs for ensuring that missed schedules are executed, you might need to implement additional logic within your deployment workflow or potentially use external monitoring and recovery systems to handle the catch-up process.