---
url: https://veles.beyondthecloud.dev/docs/setup/background-jobs.md
description: >-
  What each scheduled job does, which ones are off by default, and how to change
  cadence and retention.
---

# Background jobs

Step 3 of the Setup tab, on the Hub only. One hourly scheduler, **Veles Master Scheduler**, runs every job that is due. Each job has its own cadence: **Hourly**, **Every 3 hours**, **Every 6 hours**, **Every 12 hours** or **Daily** (02:00 in the org's time zone).

| Job                           | What it does                                                                                                                                                                            | Default         |
| ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------- |
| **Sandbox Refresh Detection** | Polls each production for completed sandbox refreshes and starts the post-refresh work. Needs **Auto-Detect Refresh** on the sandbox rows.                                              | Hourly, **off** |
| **Stuck Execution Detection** | Marks a workflow run that has shown no activity for 2 hours as failed, so it does not stay in progress forever.                                                                         | Hourly, on      |
| **Deferred Apply Watchdog**   | Retries setup actions whose asynchronous metadata deploy stalled.                                                                                                                       | Hourly, off     |
| **Scratch Org Cleanup**       | Removes scratch orgs that no longer exist in the Dev Hub from the environment list and frees their connected-org slot. Its settings can also hard-delete disconnected scratch org rows. | Hourly, off     |
| **Execution Record Cleanup**  | Deletes execution logs, workflow executions, error logs and change history older than the retention you set.                                                                            | Daily, off      |

**Schedule all** turns everything on with the defaults. **Run now** in a job's menu runs it once, immediately.

## Retention

The settings cog on **Execution Record Cleanup** holds four retention periods: execution logs, workflow executions, error logs, change history. Each defaults to 365 days. Changing them needs the Enterprise plan; the cleanup job itself runs on every plan. **Clear History** at the bottom of the Setup tab deletes execution and error logs older than a date you pick, once.

## Refresh detection in practice

Detection is hourly, so a refresh is noticed within the hour after it completes. To check sooner, open the **production** row in **Environment Management** and click **Check for refreshes now**: it looks back 7 days and queues one check. Details on [Sandbox refresh](/docs/guide/sandbox-refresh).
