temporalio / temporalio/temporal

Make the history scanner run interval configurable via dynamic config

Open
#12,101 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Go
Stars
23.2k
Forks
1.9k
Avg merge
2d 8h
Merged PRs (30d)
228

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with service/worker/scanner/workflow.go and inspect historyScannerWFStartOptions, including the current CronSchedule value. Trace how worker dynamic configuration is defined and consumed, then expose the scanner schedule or interval with the existing 12-hour behavior as the default; done means operators can change the run frequency without altering the default behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
distributed-systems
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.