How to handle two similar webhook at the same time?

Viewed 148

We have a service based on GitHub.

GitHub sends us two same webhook exactly at the same time for a specific event. On my server every webhook (event) is treated as an action, but when I receive those two events at the same time, the action is being created twice.

In your opinion what is the best way to handle this case?

For now the solution I came up with is the following:

 1. My Server receives a webhook
 2. Wait a few seconds
 3. Create an id for that webhook
 4. Check that this ID doesn't exist in my DB
 5. Create an entry in my DB with that ID

The problem with this solution is that when I receive it exactly at the same time it doesn't work.

Any thought would be appreciated!

Thank you

0 Answers
Related