Alexander Koch
Alexander Koch

Reputation: 43

eventmachine multiple sockets

When starting multiple listening sockets "servers" inside the reactor loop - is it safe to assume that a block happening in one of the listening socket callbacks to cause the other sockets to stop accepting new connections, since the reactor loop will be blocked ?

Is it then best practice to start a separate ruby process per listening socket or are there alternatives to better handle this use case?

Upvotes: 1

Views: 284

Answers (1)

phil pirozhkov
phil pirozhkov

Reputation: 4900

Sockets will still accept connections, but reactor will be blocked if any single server blocks and no data will be passed to other servers. It's not a bad idea to spawn a new process. And it's even a better idea to avoid blocking operation in callbacks.

Upvotes: 1

Related Questions