Skip to content
pgflow is in public beta. See project status for production readiness details.

Update Deployed Flows

When updating flows that are already deployed to production, use the deprecation workflow to prevent old and new worker versions from processing tasks simultaneously.

  1. Deprecate old workers

    UPDATE pgflow.workers
    SET deprecated_at = NOW()
    WHERE function_name = 'your-worker-name'
    AND deprecated_at IS NULL;

    This stops old workers from polling for new tasks while they finish current work.

  2. Deploy new version

    npx supabase functions deploy your-worker-name
  3. Start new worker

    curl "https://your-project.supabase.co/functions/v1/your-worker-name" \
    -H "Authorization: Bearer YOUR_ANON_KEY"
  4. Keep workers up

    Set up the pg_cron safety net for reliable production operation.

Without deprecation, old workers run for up to 150s (free tier) or 400s (paid) after deployment, causing both versions to process tasks simultaneously.

Deprecation fixes this: workers check their status every 5 seconds and immediately stop polling for new tasks when deprecated, while finishing current work.

Find your ANON key in Supabase Dashboard → Settings → API → anon public key.

Track deployment progress with this query:

SELECT
function_name,
COUNT(*) FILTER (WHERE deprecated_at IS NULL) as active_workers,
COUNT(*) FILTER (WHERE deprecated_at IS NOT NULL) as deprecated_workers
FROM pgflow.workers
WHERE last_heartbeat_at > now() - interval '6 seconds'
GROUP BY function_name;