|
6 | 6 | from skynet.auth.jwt import authorize |
7 | 7 | from skynet.env import bypass_auth, whisper_flush_interval |
8 | 8 | from skynet.logs import get_logger |
9 | | -from skynet.modules.monitoring import dec_ws_conn_count, inc_ws_conn_count |
| 9 | +from skynet.modules.monitoring import update_ws_conn_count |
10 | 10 | from skynet.modules.stt.streaming_whisper.meeting_connection import MeetingConnection |
11 | 11 | from skynet.modules.stt.streaming_whisper.utils import utils |
12 | 12 |
|
@@ -34,9 +34,9 @@ async def connect(self, websocket: WebSocket, meeting_id: str, auth_token: str | |
34 | 34 | if self.flush_audio_task is None: |
35 | 35 | loop = asyncio.get_running_loop() |
36 | 36 | self.flush_audio_task = loop.create_task(self.flush_working_audio_worker()) |
37 | | - inc_ws_conn_count() |
38 | | - log.info(f'Meeting with id {meeting_id} started. Ongoing meetings {len(self.connections)}') |
39 | | - |
| 37 | + current_connections = len(self.connections) |
| 38 | + log.info(f'Meeting with id {meeting_id} started. Ongoing meetings {current_connections}') |
| 39 | + await update_ws_conn_count(current_connections) |
40 | 40 | return connection |
41 | 41 |
|
42 | 42 | async def process(self, connection: MeetingConnection, chunk: bytes, chunk_timestamp: int): |
@@ -73,7 +73,9 @@ async def disconnect(self, connection: MeetingConnection, already_closed=False): |
73 | 73 | else: |
74 | 74 | # mark connection as disconnected |
75 | 75 | connection.disconnect() |
76 | | - dec_ws_conn_count() |
| 76 | + remaining_connections = len(self.connections) |
| 77 | + log.info(f'Disconnected meeting {connection.meeting_id}, remaining connections {remaining_connections}') |
| 78 | + await update_ws_conn_count(remaining_connections) |
77 | 79 |
|
78 | 80 | async def flush_working_audio_worker(self): |
79 | 81 | """ |
|
0 commit comments