8000 feat: `exponentialBackoff` field · Issue #1019 · dagu-org/dagu · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
8000
feat: exponentialBackoff field #1019
Open
@yottahmd

Description

@yottahmd

Currently, repeatPolicy only supports fixed intervals between retries. This doesn't handle scenarios where services need progressively longer recovery times.

Design

Add an exponentialBackoff boolean field to enable exponential backoff behavior:

steps:
  - name: check-service
    command: curl -f https://api.example.com/health
    repeatPolicy:
      intervalSec: 1          # Initial interval
      limit: 5                # Max attempts
      exponentialBackoff: true  # Enable exponential backoff
      exitCode: [1]           # Repeat on failure

Behavior:

  • 1st retry: 1s
  • 2nd retry: 2s
  • 3rd retry: 4s
  • 4th retry: 8s
  • 5th retry: 16s

Implementation

  1. Add ExponentialBackoff bool to RepeatPolicy struct in /internal/digraph/step.go
  2. Update scheduler logic in /internal/digraph/scheduler/scheduler.go:334 to calculate interval as: interval * (2^retryCount)
  3. Use existing node.State().DoneCount to track retry attempts

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0