Make the history scanner run interval configurable via dynamic config
The history scanner ("scavenger") is what reclaims orphaned history branches — history_tree / history_node rows whose workflow execution no longer exists. That includes history left behind by rejected or deduplicated StartWorkflowExecution calls.
Its cleanup threshold is tunable via worker.historyScannerDataMinAge, but how often it runs is hardcoded to every 12 hours currently.
// service/worker/scanner/workflow.go
historyScannerWFStartOptions = client.StartWorkflowOptions{
ID: historyScannerWFID,
TaskQueue: historyScannerTaskQueueName,
WorkflowIDReusePolicy: enumspb.WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE,
CronSchedule: "0 */12 * * *",
}So if user sets low historyScannerDataMinAge, cleanup really only runs twice a day.
Requested change:
Expose the history scanner's run interval as dynamic config (for example worker.historyScannerCronSchedule, or an interval such as worker.historyScannerInterval), defaulting to the current 12 hour behavior so nothing changes unless an operator opts in.
Source: temporalio/temporal