Run Mutation based on successful jobs
We have an import flow for our Airbnb App that imports multiple pieces of data, namely:
- Listings
- Reservations for each listing
- Conversations for each reservation
- Messages for each conversation
When a user imports a listing, we run action to fetch listings, reservations, conversations, and messages.
After fetching listings and reservations (not using the scheduler), we use the reservationIds to schedule actions to fetch conversations and messages. We update the user's subscription details after the function calls to schedule these actions. So if these scheduled actions fail, we still update the subscription anyways.
How should we go about updating the subscription only after the actions are successful and not when they fail?
2 Replies
The sub-jobs have a specific top-level listingId attached to the job description, so we know it belongs to which listing
Hey @punn, I think you may find this post from Ian helpful: https://stack.convex.dev/background-job-management
I believe this article hits on the patterns you likely need.
Background Job Management
Implement asynchronous job patterns using a table to track progress. Fire-and-forget, cancelation, timeouts, and more.