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.
Update Workflow
Section titled “Update Workflow”-
Deprecate old workers
UPDATE pgflow.workersSET 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.
-
Deploy new version
npx supabase functions deploy your-worker-name -
Start new worker
curl "https://your-project.supabase.co/functions/v1/your-worker-name" \-H "Authorization: Bearer YOUR_ANON_KEY" -
Keep workers up
Set up the pg_cron safety net for reliable production operation.
Deployment Details
Section titled “Deployment Details”Why Worker Deprecation
Section titled “Why Worker Deprecation”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.
Getting Your ANON Key
Section titled “Getting Your ANON Key”Find your ANON key in Supabase Dashboard → Settings → API → anon public key.
Monitoring Workers
Section titled “Monitoring Workers”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_workersFROM pgflow.workersWHERE last_heartbeat_at > now() - interval '6 seconds'GROUP BY function_name;