Move ZMQConnectorBase to networking

This commit is contained in:
Bálint Bokros 2018-02-13 17:44:48 +01:00
parent dbc2d1c0ea
commit f5a8230d3b
6 changed files with 11 additions and 10 deletions

View File

@ -3,7 +3,7 @@ from zmq.eventloop import ioloop
from zmq.eventloop.zmqstream import ZMQStream
from tfw.config import tfwenv
from tfw.util import ZMQConnectorBase
from tfw.networking.zmq_connector_base import ZMQConnectorBase
ioloop.install()

View File

@ -4,7 +4,7 @@ from zmq.eventloop.zmqstream import ZMQStream
from tfw.networking.serialization import serialize_all
from tfw.config import tfwenv
from tfw.util import ZMQConnectorBase
from tfw.networking.zmq_connector_base import ZMQConnectorBase
class ServerDownlinkConnector(ZMQConnectorBase):

View File

@ -5,7 +5,7 @@ from tfw.networking.serialization import serialize_all
from tfw.config import tfwenv
from tfw.config.logs import logging
log = logging.getLogger(__name__)
from tfw.util import ZMQConnectorBase
from tfw.networking.zmq_connector_base import ZMQConnectorBase
class EventHandlerDownlinkConnector(ZMQConnectorBase):

View File

@ -2,7 +2,7 @@ import zmq
from zmq.eventloop import ioloop
from tfw.config import tfwenv
from tfw.util import ZMQConnectorBase
from tfw.networking.zmq_connector_base import ZMQConnectorBase
from tfw.networking.serialization import serialize_all, deserialize_all
ioloop.install()

View File

@ -0,0 +1,6 @@
import zmq
class ZMQConnectorBase:
def __init__(self, zmq_context=None):
self._zmq_context = zmq_context or zmq.Context.instance()

View File

@ -1,4 +1,4 @@
import xmlrpc.client, zmq
import xmlrpc.client
from contextlib import suppress
from xmlrpc.client import Fault as SupervisorFault
from time import time, sleep
@ -30,11 +30,6 @@ class SupervisorMixin:
self.start_process()
class ZMQConnectorBase:
def __init__(self, zmq_context=None):
self._zmq_context = zmq_context or zmq.Context.instance()
class RateLimiter:
def __init__(self, rate_per_second):
self.min_interval = 1 / float(rate_per_second)