|
| 1 | +# Task scheduler |
| 2 | + |
| 3 | +The task scheduler runs or triggers recurring background activities like vulnerability |
| 4 | +data source mirroring, integration uploads, metric updates, and maintenance |
| 5 | +sweeps. The [durable execution engine](dex-engine.md) handles the bulk of |
| 6 | +asynchronous work and is a separate subsystem. |
| 7 | + |
| 8 | +Nodes with the scheduler enabled coexist safely. The scheduler coordinates |
| 9 | +execution through the database, so each due task runs on exactly one node |
| 10 | +without requiring leader election. |
| 11 | + |
| 12 | +## Configuration |
| 13 | + |
| 14 | +You can turn the scheduler off on a per-node basis, for example to dedicate |
| 15 | +specific nodes to serving web traffic. The `threads` setting caps how many |
| 16 | +scheduled tasks may run concurrently on a single node. Because the |
| 17 | +[durable execution engine](dex-engine.md) performs most asynchronous work, |
| 18 | +this is rarely the right knob to tune. |
| 19 | + |
| 20 | +Configuration: |
| 21 | + |
| 22 | +- [`dt.task-scheduler.enabled`](properties.md#dttask-schedulerenabled) |
| 23 | +- [`dt.task-scheduler.threads`](properties.md#dttask-schedulerthreads) |
| 24 | +- [`dt.task-scheduler.poll-interval-ms`](properties.md#dttask-schedulerpoll-interval-ms) |
| 25 | +- [`dt.task-scheduler.shutdown-max-wait-ms`](properties.md#dttask-schedulershutdown-max-wait-ms) |
| 26 | + |
| 27 | +## Cron expressions |
| 28 | + |
| 29 | +Each scheduled task takes its schedule from a `dt.task.<name>.cron` property, |
| 30 | +which holds a five-field UNIX cron expression: |
| 31 | + |
| 32 | +```text |
| 33 | +minute hour day-of-month month day-of-week |
| 34 | +``` |
| 35 | + |
| 36 | +All expressions use **UTC**. |
| 37 | + |
| 38 | +Example, run every day at 03:30 UTC: |
| 39 | + |
| 40 | +```ini |
| 41 | +dt.task.nvd-vuln-data-source-mirror.cron=30 3 * * * |
| 42 | +``` |
| 43 | + |
| 44 | +## Scheduled tasks |
| 45 | + |
| 46 | +The scheduler ships with the following recurring tasks. Tasks marked with |
| 47 | +[^1] also run once shortly after startup, with a random delay of up to one |
| 48 | +minute. |
| 49 | + |
| 50 | +| Task | Property | Default cron | Purpose | |
| 51 | +|-----------------------------------|-------------------------------------------------------------------------------------------------------------------------|------------------|-----------------------------------------------------------------------------------------------| |
| 52 | +| Portfolio metrics update | [`dt.task.portfolio-metrics-update.cron`](properties.md#dttaskportfolio-metrics-updatecron) | `10 * * * *` | Refreshes per-project and portfolio time series metrics. | |
| 53 | +| Vulnerability metrics update | [`dt.task.vuln-metrics-update.cron`](properties.md#dttaskvuln-metrics-updatecron) | `0 */6 * * *` | Refreshes counters used by the vulnerability dashboard. | |
| 54 | +| Portfolio vulnerability analysis | [`dt.task.portfolio-analysis.cron`](properties.md#dttaskportfolio-analysiscron) | `0 6 * * *` | Re-analyzes every component in the portfolio against current vulnerability data. | |
| 55 | +| NVD mirror[^1] | [`dt.task.nvd-vuln-data-source-mirror.cron`](properties.md#dttasknvd-vuln-data-source-mirrorcron) | `0 4 * * *` | Mirrors the NIST National Vulnerability Database. | |
| 56 | +| GitHub Advisories mirror[^1] | [`dt.task.github-advisory-vuln-data-source-mirror.cron`](properties.md#dttaskgithub-advisory-vuln-data-source-mirrorcron) | `0 2 * * *` | Mirrors the GitHub Advisory Database. | |
| 57 | +| OSV mirror[^1] | [`dt.task.osv-vuln-data-source-mirror.cron`](properties.md#dttaskosv-vuln-data-source-mirrorcron) | `0 3 * * *` | Mirrors the OSV vulnerability database. | |
| 58 | +| EPSS mirror[^1] | [`dt.task.epss-mirror.cron`](properties.md#dttaskepss-mirrorcron) | `0 1 * * *` | Mirrors the FIRST EPSS scores feed. | |
| 59 | +| Vulnerability database maintenance | [`dt.task.vuln-database-maintenance.cron`](properties.md#dttaskvuln-database-maintenancecron) | `0 0 * * *` | Removes orphaned vulnerability records and reconciles indexes. | |
| 60 | +| Vulnerability policy bundle sync[^1] | [`dt.task.vuln-policy-bundle-sync.cron`](properties.md#dttaskvuln-policy-bundle-synccron) | `*/15 * * * *` | Pulls the configured vulnerability policy bundle. No-op when `dt.vuln-policy-bundle.url` is empty. | |
| 61 | +| Package metadata resolution | [`dt.task.package-metadata-resolution.cron`](properties.md#dttaskpackage-metadata-resolutioncron) | `0 1 * * *` | Refreshes outdated-component status for portfolio components. | |
| 62 | +| Package metadata maintenance | [`dt.task.package-metadata-maintenance.cron`](properties.md#dttaskpackage-metadata-maintenancecron) | `0 */12 * * *` | Removes stale and orphaned package metadata records. | |
| 63 | +| Metrics maintenance | [`dt.task.metrics-maintenance.cron`](properties.md#dttaskmetrics-maintenancecron) | `1 * * * *` | Compacts time series metric history. | |
| 64 | +| Tag maintenance | [`dt.task.tag-maintenance.cron`](properties.md#dttasktag-maintenancecron) | `0 */12 * * *` | Removes unused tags. | |
| 65 | +| Project maintenance | [`dt.task.project-maintenance.cron`](properties.md#dttaskproject-maintenancecron) | `0 */4 * * *` | Applies project retention and cleanup rules. | |
| 66 | +| Fortify SSC upload | [`dt.task.fortify-ssc-upload.cron`](properties.md#dttaskfortify-ssc-uploadcron) | `0 2 * * *` | Uploads finding reports to Fortify SSC. | |
| 67 | +| DefectDojo upload | [`dt.task.defect-dojo-upload.cron`](properties.md#dttaskdefect-dojo-uploadcron) | `0 2 * * *` | Uploads finding reports to DefectDojo. | |
| 68 | +| Kenna Security upload | [`dt.task.kenna-security-upload.cron`](properties.md#dttaskkenna-security-uploadcron) | `0 2 * * *` | Uploads finding reports to Kenna Security. | |
| 69 | +| Expired session cleanup | [`dt.task.expired-session-cleanup.cron`](properties.md#dttaskexpired-session-cleanupcron) | `0 * * * *` | Deletes expired user session tokens. | |
| 70 | +| Scheduled notification dispatch | [`dt.task.scheduled-notification-dispatch.cron`](properties.md#dttaskscheduled-notification-dispatchcron) | `* * * * *` | Polls for due scheduled notification rules and dispatches them. | |
| 71 | +| Telemetry submission[^1] | [`dt.task.telemetry-submission.cron`](properties.md#dttasktelemetry-submissioncron) | `0 */1 * * *` | Submits anonymous usage data. See [Telemetry](telemetry.md). | |
| 72 | + |
| 73 | +[^1]: Triggered once on startup with a random delay of up to one minute, then on the configured schedule. |
0 commit comments