|
@@ -52,6 +52,7 @@ class SessionManager:
|
|
|
"""
|
|
"""
|
|
|
We use a redis backchannel to send actions between server nodes
|
|
We use a redis backchannel to send actions between server nodes
|
|
|
"""
|
|
"""
|
|
|
|
|
+ logger.debug('_redis_subscribe')
|
|
|
redis_client = self._get_redis_client()
|
|
redis_client = self._get_redis_client()
|
|
|
pubsub = redis_client.pubsub()
|
|
pubsub = redis_client.pubsub()
|
|
|
await pubsub.subscribe('oh_event')
|
|
await pubsub.subscribe('oh_event')
|
|
@@ -75,7 +76,7 @@ class SessionManager:
|
|
|
|
|
|
|
|
async def _process_message(self, message: dict):
|
|
async def _process_message(self, message: dict):
|
|
|
data = json.loads(message['data'])
|
|
data = json.loads(message['data'])
|
|
|
- logger.info(f'got_published_message:{message}')
|
|
|
|
|
|
|
+ logger.debug(f'got_published_message:{message}')
|
|
|
sid = data['sid']
|
|
sid = data['sid']
|
|
|
message_type = data['message_type']
|
|
message_type = data['message_type']
|
|
|
if message_type == 'event':
|
|
if message_type == 'event':
|
|
@@ -112,7 +113,7 @@ class SessionManager:
|
|
|
elif message_type == 'session_closing':
|
|
elif message_type == 'session_closing':
|
|
|
# Session closing event - We only get this in the event of graceful shutdown,
|
|
# Session closing event - We only get this in the event of graceful shutdown,
|
|
|
# which can't be guaranteed - nodes can simply vanish unexpectedly!
|
|
# which can't be guaranteed - nodes can simply vanish unexpectedly!
|
|
|
- logger.info(f'session_closing:{sid}')
|
|
|
|
|
|
|
+ logger.debug(f'session_closing:{sid}')
|
|
|
for (
|
|
for (
|
|
|
connection_id,
|
|
connection_id,
|
|
|
local_sid,
|
|
local_sid,
|
|
@@ -142,7 +143,9 @@ class SessionManager:
|
|
|
async def detach_from_conversation(self, conversation: Conversation):
|
|
async def detach_from_conversation(self, conversation: Conversation):
|
|
|
await conversation.disconnect()
|
|
await conversation.disconnect()
|
|
|
|
|
|
|
|
- async def init_or_join_session(self, sid: str, connection_id: str, session_init_data: SessionInitData):
|
|
|
|
|
|
|
+ async def init_or_join_session(
|
|
|
|
|
+ self, sid: str, connection_id: str, session_init_data: SessionInitData
|
|
|
|
|
+ ):
|
|
|
await self.sio.enter_room(connection_id, ROOM_KEY.format(sid=sid))
|
|
await self.sio.enter_room(connection_id, ROOM_KEY.format(sid=sid))
|
|
|
self.local_connection_id_to_session_id[connection_id] = sid
|
|
self.local_connection_id_to_session_id[connection_id] = sid
|
|
|
|
|
|
|
@@ -165,6 +168,7 @@ class SessionManager:
|
|
|
flag = asyncio.Event()
|
|
flag = asyncio.Event()
|
|
|
self._session_is_running_flags[sid] = flag
|
|
self._session_is_running_flags[sid] = flag
|
|
|
try:
|
|
try:
|
|
|
|
|
+ logger.debug(f'publish:is_session_running:{sid}')
|
|
|
await self._get_redis_client().publish(
|
|
await self._get_redis_client().publish(
|
|
|
'oh_event',
|
|
'oh_event',
|
|
|
json.dumps(
|
|
json.dumps(
|