mirror of
https://github.com/jkingsman/Remote-Terminal-for-MeshCore.git
synced 2026-03-28 17:43:05 +01:00
Remove vestigial duplicate checking
This commit is contained in:
@@ -86,19 +86,14 @@ async def create_message_from_decrypted(
|
||||
)
|
||||
|
||||
if msg_id is None:
|
||||
# Duplicate detected - find existing message ID for packet linkage
|
||||
existing_id = await MessageRepository.find_duplicate(
|
||||
conversation_key=channel_key_normalized,
|
||||
text=text,
|
||||
sender_timestamp=timestamp,
|
||||
)
|
||||
logger.debug(
|
||||
"Duplicate message detected for channel %s (existing id=%s)",
|
||||
# This shouldn't happen - raw packets are deduplicated by payload hash,
|
||||
# so the same message content shouldn't be created twice. Log a warning.
|
||||
logger.warning(
|
||||
"Unexpected duplicate message for channel %s (packet_id=%d) - "
|
||||
"this may indicate a bug in payload deduplication",
|
||||
channel_key_normalized[:8],
|
||||
existing_id,
|
||||
packet_id,
|
||||
)
|
||||
if existing_id:
|
||||
await RawPacketRepository.mark_decrypted(packet_id, existing_id)
|
||||
return None
|
||||
|
||||
logger.info("Stored channel message %d for channel %s", msg_id, channel_key_normalized[:8])
|
||||
|
||||
@@ -377,33 +377,6 @@ class MessageRepository:
|
||||
row = await cursor.fetchone()
|
||||
return row["acked"] if row else 1
|
||||
|
||||
@staticmethod
|
||||
async def find_duplicate(
|
||||
conversation_key: str,
|
||||
text: str,
|
||||
sender_timestamp: int | None,
|
||||
) -> int | None:
|
||||
"""Find existing message with same content (for deduplication).
|
||||
|
||||
Returns message ID if found, None otherwise.
|
||||
Used to detect the same message arriving via multiple RF paths.
|
||||
"""
|
||||
if sender_timestamp is None:
|
||||
return None
|
||||
|
||||
cursor = await db.conn.execute(
|
||||
"""
|
||||
SELECT id FROM messages
|
||||
WHERE conversation_key = ?
|
||||
AND text = ?
|
||||
AND sender_timestamp = ?
|
||||
LIMIT 1
|
||||
""",
|
||||
(conversation_key, text, sender_timestamp),
|
||||
)
|
||||
row = await cursor.fetchone()
|
||||
return row["id"] if row else None
|
||||
|
||||
@staticmethod
|
||||
async def get_bulk(
|
||||
conversations: list[dict],
|
||||
|
||||
Reference in New Issue
Block a user