How can I run an internalAction from an
How can I run an internalAction from an internalMutation? It's telling me ctx.runAction from an internalMutation is not a function
3 Replies
This gets it across! Generally to run an internalAction from an internalMutation you'd schedule it with
ctx.scheduler.runAfter(0, internal.foo.myAction, {})
.
At the JavaScript/TypeScript level I'd say both actions and mutations are async (they're functions that can return promises, and you can use await
inside of them) but it's true that actions can run for much longer than mutations. Actions have a limit of something like 10 minutes, while mutations need to finish in a few seconds (it's helpful to make transactions short, and mutations are transactions). So running an action from a mutation would be a problem for these time limits.super helpful thank you very much