mirror of
https://github.com/fastogt/fastocloud_admin.git
synced 2025-03-09 23:38:52 +00:00
Fixed requests
This commit is contained in:
parent
99184859a4
commit
020091e227
1 changed files with 8 additions and 2 deletions
|
@ -16,6 +16,7 @@ class SubscriberConnection(SubscriberClient):
|
||||||
self._current_stream_id = str()
|
self._current_stream_id = str()
|
||||||
self._device = None
|
self._device = None
|
||||||
self._last_ping_ts = make_utc_timestamp() / 1000
|
self._last_ping_ts = make_utc_timestamp() / 1000
|
||||||
|
self._request_id = 0
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def info(self) -> Subscriber:
|
def info(self) -> Subscriber:
|
||||||
|
@ -57,6 +58,11 @@ class SubscriberConnection(SubscriberClient):
|
||||||
self.process_commands(data)
|
self.process_commands(data)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def gen_request_id(self) -> int:
|
||||||
|
current_value = self._request_id
|
||||||
|
self._request_id += 1
|
||||||
|
return current_value
|
||||||
|
|
||||||
|
|
||||||
class ServiceManager(IClientHandler):
|
class ServiceManager(IClientHandler):
|
||||||
SUBSCRIBER_PORT = 6000
|
SUBSCRIBER_PORT = 6000
|
||||||
|
@ -123,7 +129,7 @@ class ServiceManager(IClientHandler):
|
||||||
|
|
||||||
for client in self._subscribers:
|
for client in self._subscribers:
|
||||||
if ts_sec - client.last_ping_ts > ServiceManager.PING_SUBSCRIBERS_SEC:
|
if ts_sec - client.last_ping_ts > ServiceManager.PING_SUBSCRIBERS_SEC:
|
||||||
client.ping()
|
client.ping(client.gen_request_id())
|
||||||
client.last_ping_ts = ts_sec
|
client.last_ping_ts = ts_sec
|
||||||
|
|
||||||
def process_response(self, client, req: Request, resp: Response):
|
def process_response(self, client, req: Request, resp: Response):
|
||||||
|
@ -216,7 +222,7 @@ class ServiceManager(IClientHandler):
|
||||||
client.disconnect()
|
client.disconnect()
|
||||||
return
|
return
|
||||||
|
|
||||||
client.pong()
|
client.pong(cid)
|
||||||
|
|
||||||
def _handle_get_channels(self, client, cid: str, params: dict):
|
def _handle_get_channels(self, client, cid: str, params: dict):
|
||||||
if not self._check_is_auth_client(client):
|
if not self._check_is_auth_client(client):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue