Tune Deployed Flows
After deploying flows to production, you may need to adjust retry behavior, timeouts, or delays based on real-world performance. This guide shows how to tune these runtime configuration options without recompiling or redeploying.
For structural changes like adding steps or changing dependencies, create a new flow version instead (see Version Your Flows).
What Can Be Updated
Section titled “What Can Be Updated”You can safely modify these runtime options for existing flows without creating a new version:
| DSL Option | Database Column | Default | Reference |
|---|---|---|---|
maxAttempts | opt_max_attempts | 3 | maxAttempts |
baseDelay | opt_base_delay | 1 | baseDelay |
timeout | opt_timeout | 60 | timeout |
startDelay | opt_start_delay | 0 | startDelay |
pgflow uses a two-level configuration approach where flow-level options set defaults and step-level options override them. Note that startDelay is step-level only.
Updating Options Manually
Section titled “Updating Options Manually”Since the compiler doesn’t support updating existing flows, you must manually update options in the database:
Flow Level (Affects All Steps)
Section titled “Flow Level (Affects All Steps)”UPDATE pgflow.flowsSET opt_max_attempts = 5, opt_timeout = 10, opt_base_delay = 2WHERE flow_slug = 'your_flow_slug';Step Level (Overrides Flow Defaults)
Section titled “Step Level (Overrides Flow Defaults)”UPDATE pgflow.stepsSET opt_max_attempts = 3, opt_timeout = 30, opt_start_delay = 5WHERE flow_slug = 'your_flow_slug' AND step_slug = 'your_step_slug';Example: Increasing Retries for API Calls
Section titled “Example: Increasing Retries for API Calls”A common scenario is adjusting retry behavior after observing production issues:
-- Check current settingsSELECT step_slug, opt_max_attempts, opt_timeoutFROM pgflow.stepsWHERE flow_slug = 'analyze_website';
-- Update API call step to retry moreUPDATE pgflow.stepsSET opt_max_attempts = 5, opt_timeout = 120WHERE flow_slug = 'analyze_website' AND step_slug = 'website';