PietroP
Convex Community2y ago
22 replies
Pietro

Trigger/onUpdate Functions

I'd love to have Trigger functions (in addition to scheduled) : functions that are executed when a query returns.
Similar to having a service that runs new Convexclient().onUpdate(query) but that actually runs "inside convex.

I'm aware of the schedule.runAt(0...) pattern which is also nice, but I think the trigger pattern is more expressive, allowing muliple paralel behaviors to occur independently, and allows better modelling of fail scenarios and keeps the mutations cleaner.

Also, I cant implement onUpdate patterns in for example vercel functions, having this would allow me to stay reactive withouth the burden of a stateful server.

Usecase:
I have datapoints being created in a table, with multiple mutations, from multiple sources and I want to model multiple parallel background job/queue that are triggered as soon as possible bc they are user facing. Cron not ideal because "asap" not "later".
Was this page helpful?