archive
/
ipc-unix
Archived
1
Fork 0

Scale timeout with number of connections

This commit is contained in:
Jake Howard 2018-12-08 14:28:26 +00:00
parent 7fd83b05b9
commit 6920b43567
Signed by: jake
GPG Key ID: 57AFB45680EDD477
1 changed files with 7 additions and 2 deletions

View File

@ -4,7 +4,7 @@ import socket
import threading
import ujson
from ipc_unix.utils import read_payload, socket_has_data
from ipc_unix.utils import DEFAULT_SOCKET_READ_TIMEOUT, read_payload, socket_has_data
class Subscriber:
@ -83,7 +83,12 @@ class Publisher:
self.connections.append(new_socket)
def write(self, message: dict):
_, writable, errorable = select.select([], self.connections, [], 1)
_, writable, errorable = select.select(
[],
self.connections,
[],
DEFAULT_SOCKET_READ_TIMEOUT * len(self.connections),
)
dead_sockets = []