Because continuations can lead to multiple long-running actions, there are some limits on their usage.
The limits for using continuations in Apex are listed in the Apex Developer Guide.
Here are a few more limits specific to usage in Lightning web components.
- Up to three callouts per continuation
Continuationobject can contain a maximum of three callouts.
- Serial processing for continuation actions
The framework processes actions containing a continuation serially from the client. The previous continuation invocation must have completed before the next continuation invocation is made. At any time, there can be only one continuation in progress on the client.
- DML operation restrictions
An Apex method that returns a
Continuationobject can't perform any Data Manipulation Language (DML) operations. DML statements insert, update, merge, delete, and restore data in Salesforce. If there is any DML performed within the continuation method, the continuation execution doesn't proceed, the transaction is rolled back, and an error is returned.
You can perform DML operations in the Apex callback method for the continuation.