The webhook guide mentions that a best practice is to use a queue to process webhook events and to generate an idempotency key based on the topic and resource self link. It doesn’t mention how long you should wait before processing the events to allow multiple events on the same resource to come in.
My architecture would be:
- Immediately throw every new event in a delayed jobs queue unless its idempotency key matches one already in the table
- Run the event processing job after a short delay of maybe 5 minutes to allow similar events on the same resource to come in.
- Delete the event from the processing queue to allow for future events on same resource.
Is that a reasonable delay or am I thinking about this wrong?
Appreciate the feedback.