Skip to content

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).

You can safely modify these runtime options for existing flows without creating a new version:

DSL OptionDatabase ColumnDefaultReference
maxAttemptsopt_max_attempts3maxAttempts
baseDelayopt_base_delay1baseDelay
timeoutopt_timeout60timeout
startDelayopt_start_delay0startDelay

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.

Since the compiler doesn’t support updating existing flows, you must manually update options in the database:

UPDATE pgflow.flows
SET opt_max_attempts = 5, opt_timeout = 10, opt_base_delay = 2
WHERE flow_slug = 'your_flow_slug';
UPDATE pgflow.steps
SET opt_max_attempts = 3, opt_timeout = 30, opt_start_delay = 5
WHERE flow_slug = 'your_flow_slug' AND step_slug = 'your_step_slug';

A common scenario is adjusting retry behavior after observing production issues:

-- Check current settings
SELECT step_slug, opt_max_attempts, opt_timeout
FROM pgflow.steps
WHERE flow_slug = 'analyze_website';
-- Update API call step to retry more
UPDATE pgflow.steps
SET opt_max_attempts = 5, opt_timeout = 120
WHERE flow_slug = 'analyze_website' AND step_slug = 'website';