#stop a mutation from retrying
4 messages · Page 1 of 1 (latest)
Hi @valid cloud. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
Based on the knowledge sources, there isn't a direct way to stop a Convex mutation from retrying once it has been initiated. Convex mutations are designed to automatically retry until they succeed, which is a core feature of the platform's reliability model.
Here's what we know about mutation retries in Convex:
-
Automatic retries: Convex React automatically retries mutations until they are confirmed to have been written to the database. The backend ensures that despite multiple retries, every mutation call only executes once Link to React docs.
-
Retry behavior: When using the WebSocket-powered client, it first records the mutation arguments and a unique ID client-side, then makes the request, retrying on failure. If the server has already processed that ID, it returns the same result as the original Link to Durable Workflows.
-
Cancellation: Currently, there doesn't appear to be a way to cancel a mutation once it's been initiated. A community member asked about this specific scenario (canceling a mutation when network is down), and the Convex team acknowledged that canceling a mutation would be reasonable but isn't currently supported Link to Discord thread.
For your use case, you might consider these alternatives:
- Use optimistic updates to make your UI more responsive and show the user that something is happening, even if the mutation is still retrying in the background.
- If you're using actions (which don't automatically retry), you can control retry behavior using components like the Workpool component or the Workflow component.
- Design your mutations to be idempotent so that multiple executions don't cause issues.