Timeout
In Salesforce governor limits and API integrations, the maximum time allowed for a transaction, callout, or query to complete before Salesforce terminates it, preventing long-running processes from consuming shared resources.
Definition
In Salesforce governor limits and API integrations, the maximum time allowed for a transaction, callout, or query to complete before Salesforce terminates it, preventing long-running processes from consuming shared resources.
In plain English
“A Timeout in Salesforce governor limits and API integrations is the maximum time allowed for a transaction, callout, or query to complete before Salesforce terminates it. Timeouts prevent long-running processes from consuming shared resources in the multi-tenant environment.”
Worked example
An Apex developer at Dunstable Construction calls a slow third-party API from a button click. By default, an Apex callout has a 10-second Timeout; he sets it to 30 seconds via req.setTimeout(30000) because the third-party API is slow. If the API doesn't respond within 30 seconds, Salesforce raises a Timeout exception and the transaction rolls back. The Timeout protects platform stability - without it, a hung external service could lock up Apex transactions indefinitely, blocking other workloads. Maximum allowed callout Timeout is 120 seconds; the 30-second value is the developer's tuned value for this specific integration.
Why Timeout matters
In Salesforce governor limits and API integrations, a Timeout is the maximum time allowed for a transaction, callout, or query to complete before Salesforce terminates it, preventing long-running processes from consuming shared resources in the multi-tenant environment. Different contexts have different timeout limits: Apex callouts (120 seconds), synchronous transactions, and others.
Timeouts are governor limits for time, just as other limits govern records, queries, and CPU. Understanding timeout limits is essential for designing integrations and complex processes that work within the platform's constraints. Mature developers design with timeouts in mind, using async patterns for long-running work.
How organizations use Timeout
Trains developers on timeout limits for different contexts (callouts, transactions, etc.).
Uses async patterns for operations that might exceed synchronous timeout limits.
Designs integrations with timeout awareness for reliability.
Test your knowledge
Q1. What is a Timeout?
Q2. Why do they exist?
Q3. What's the callout timeout?
Discussion
Loading discussion…