runafter vs wrapper-action
Hi there, I'm wondering what is the suggested approach for the following scenario: an API endpoint that needs to perform a mutation, (optionally retrieve some data,) and the perform an operation over the network, like an httpcall.
At the moment I have two different cases in which I'm adopting two different strategies:
- I'm sending emails after storing an invitation record in convex using
scheduler.runAfer(0, internal.emails.sendemail)
from whitin the mutation that stores the invitation record
- I'm sending push notification after storing a message in convex. I have a convex action that wraps (1) the mutation that stores the message; (2) the query to retrieve the push subscriptions; (3) the action to send the notifications.
What would be the suggested approach for this kind of scenarios?4 Replies
Thanks for posting in <#1088161997662724167>.
Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets.
- Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.)
- Use search.convex.dev to search Docs, Stack, and Discord all at once.
- Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI.
- Avoid tagging staff unless specifically instructed.
Thank you!
the first approach is the common one, and the recommended one
from the zen of convex

thanks