#Get task by ID
1 messages · Page 1 of 1 (latest)
Do you mean through an API call?
You can use an idempotency key to prevent duplicate runs from happening, which might be a better solution
That could actually be useful, but I'm not sure what to use as a key.
What we did is the following:
We have a Nuxt server that exposes trigger tasks as an endpoint.
The two runs that we want to prevent from being executed simultaneously are a file import and a massive Algolia reindex. The point is that I don't believe I have something readily usable as an idempotency key to prevent duplicate runs because duplicate runs should actually be a possibility.
Currently, we are limiting the concurrency to one run, so that other hits to the endpoint just queue up other runs.
You could add both tasks to the same task queue and limit that queues concurrency to 1, so only 1 task could run at a time? https://trigger.dev/docs/v3/queue-concurrency#defining-a-queue
The other thing you could do (which might be better) is to create a single task that calls those "file import" and "algolia reindex" tasks
With triggerAndWait
Then you could trigger that "parent" task from the Nuxt endpoint. And the parent task could have a concurrency of 1