Why are these throttled messages executing while earlier message has failed #1256
-
I have this set of coordinated Inngest functions: Their purpose is to push mutation events into airtable. You will notice that I try to limit any messages for a tenant and environment pair to 1, attempting to ensure the correct application order of the events (see https://github.com/cozemble/breezbook/blob/8949f2d5c2819b0597c6c54d9ff1cf3b451543b4/backend/airtable/src/inngest/announceChangesToAirtable.ts#L107) What I see when I run this locally, is that later events seem to get processed when an earlier event has failed. What do I have to do to ensure that later events wait if an earlier event has failed? Thx! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
Could you clarify on what you mean by this? If so, what is the criteria for re-enabling the processing? |
Beta Was this translation helpful? Give feedback.
-
This helped a lot Darwin, thanks. It finally sank in this morning, as noted here - https://github.com/cozemble/breezbook/blob/235adf85484711e2be1229d07973edbe7f20bda2/dev-diaries/mikehogan-dev-diary.md?plain=1#L37 |
Beta Was this translation helpful? Give feedback.
-
@darwin67 Hey Darwin, Sorry for jumping on this thread, but I wanted to ask something similar. What if I want to do effectively the same as done above, only for the function as a whole? Imagine I have a function with 3 steps. This function is called in response to external events. I want to have multiple invocations wait until the first one finished. As a concrete use case - let's say you want to send 3 messages in order. You only want to second message 2 when the first has been delivered, and you send message 3 when the 2nd has been delivered. The 'delivered' notification comes from an external event. So your function is something like
And you want to ensure that messages sent to the same user wait for the previous message to be delivered, i.e. wait for the function to finish executing. Basically you want a queue at the 'functions level'. What would you suggest for this case? |
Beta Was this translation helpful? Give feedback.
Thanks for the table, that makes things a lot more clear now.
Answering your question, yes it can.
It seems you're splitting the job into multiple functions, so what I'd recommend would be either put all the steps within a function or to have a function trigger another when it's done with it's job, and not send out the events all at once.
Basically, when you read the code, it should be traceable in order by the eye, just like how you'd expect it to run sequentially.
There are 3 ways to do it with …