Long-running processes that can pause for up to a year.
Some processes take days, weeks, or even months. Durable Workflows let you write these as simple code that can pause, wait, and resume—even if servers restart.
"When a subscription is created:1. Send a welcome email immediately2. Wait 7 days3. Send a tips & tricks email4. Wait until 3 days before trial ends5. Send a trial ending reminder6. Wait for trial to end7. If not converted, send a winback email"
# This is what Backdrift generates (simplified)def subscription_workflow(subscription): # Step 1: Immediate send_welcome_email(subscription.user) # Step 2: Wait 7 days (workflow pauses, no server running) await sleep(days=7) # Step 3: Resume and send send_tips_email(subscription.user) # Step 4: Wait until specific date await sleep_until(subscription.trial_end - days(3)) # Step 5: Check and send send_trial_reminder(subscription.user) # And so on...
The magic: This code pauses at each await and resumes later—even if the server restarts, deploys happen, or days pass.
"When an expense report is submitted:1. Notify the manager2. Wait for approval (timeout: 7 days)3. If approved, process reimbursement4. If rejected, notify employee5. If timed out, escalate to director"
"When a payment fails:1. Wait 1 hour and retry2. If still failing, wait 1 day and retry3. If still failing, wait 3 days and retry4. If still failing, suspend subscription and notify user"
"When an order is placed:1. Reserve inventory2. Charge payment3. Wait for warehouse confirmation (up to 24 hours)4. Send shipping notification5. Wait for delivery confirmation6. Send review request 3 days after delivery"