2
0
forked from kodorvan/stcs

The message receipt has been sorted

This commit is contained in:
algizn97
2025-11-02 17:13:36 +05:00
parent 78f21e6718
commit dbf0a30d54
2 changed files with 255 additions and 237 deletions

View File

@@ -25,7 +25,6 @@ class WebSocketBot:
self.user_keys = {}
self.loop = None
self.message_handler = TelegramMessageHandler(telegram_bot)
self.last_execution_seq = {}
async def run_user_check_loop(self):
"""Run a loop to check for users and connect them to the WebSocket."""
@@ -106,18 +105,8 @@ class WebSocketBot:
await self.message_handler.format_order_update(message, tg_id)
async def handle_execution_update(self, message, tg_id):
"""Handle execution updates."""
data_items = message.get('data', [])
if not data_items:
return
for exec_data in data_items:
seq = exec_data.get('seq')
if tg_id not in self.last_execution_seq:
self.last_execution_seq[tg_id] = -1
if seq <= self.last_execution_seq[tg_id]:
continue
self.last_execution_seq[tg_id] = seq
await self.message_handler.format_execution_update(message, tg_id)
"""Handle execution updates without duplicate processing."""
await self.message_handler.format_execution_update(message, tg_id)
@staticmethod
async def get_users_from_db():