Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webhooks are called one after the other #56

Open
YoannAubineau opened this issue Oct 8, 2016 · 3 comments
Open

Webhooks are called one after the other #56

YoannAubineau opened this issue Oct 8, 2016 · 3 comments

Comments

@YoannAubineau
Copy link
Contributor

Currently, webhooks are called synchronously. This is because we process webhook messages from RabbitMQ one by one through a single channel (a RabbitMQ channel is synchronous by nature).

Potential solutions are:

  • consume multiple messages at the same time and acknowledge them when associated webhook is successfully called (this might imply switching to the "promise" paradigme);
  • communicate with RabbitMQ through multiple channels in parallel ;
  • start multiple instances of the webhook worker (pm2 might be helpful here).
@JMLX42
Copy link
Owner

JMLX42 commented Oct 8, 2016

Thanks for reporting this.
Not a big issue for now, right?

You should check this out: https://nodejs.org/api/cluster.html

@YoannAubineau
Copy link
Contributor Author

No, it's not a big deal for now. But it might become a problem if multiple votes are ran at the same time and one of those vote's remote server is unreachable. Each failed attempt to call an unreachable server will delay all subsequent messages from all votes by 30 seconds (or whatever value the TCP TTL is set to).

This makes me think that an other potential solution could be to shard webhook messages by vote: dedicate a queue and a worker for each active vote. I am not a big fan of this approach though as creating queues and spawning workers dynamically seems like a recipe for problems.

@JMLX42
Copy link
Owner

JMLX42 commented Oct 8, 2016

One queue per vote means we have to sync votes and their respective queue. Maybe we should... add a queue for that? Not a good idea indeed.

I'd rather have a cluster with a dozen forks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants