Upstash Documentation

context.sleep

1 min read

context.sleep() pauses workflow execution for a specified duration.

When a workflow is paused, the current request completes and a new one is automatically scheduled to resume after the delay. This ensures no compute resources are consumed during the sleep period.

Note
Always await a sleep step to properly pause execution.

Arguments#

stepNamestring#

A unique identifier for the step.

durationnumber|string#

The duration to pause workflow execution.

  • Human-readable string format:
InputDuration
"10s"10 seconds
"1m"1 minute
"30m"30 minutes
"2h"2 hours
"1d"1 day
"1w"1 week
"1mo"1 month
"1y"1 year
  • Numeric format (seconds):
InputDuration
6060 seconds (1 minute)
36003600 seconds (1 hour)
8640086400 seconds (1 day)

Usage#