Drop some duplicated logic and defns

This commit is contained in:
Jack Kingsman
2026-04-03 17:47:44 -07:00
parent e2ddf5f79f
commit 67873e8dd9
8 changed files with 58 additions and 89 deletions
+1 -6
View File
@@ -1,12 +1,7 @@
"""Shared direct-message ACK application logic."""
from collections.abc import Callable
from typing import Any
from app.services import dm_ack_tracker
from app.services.messages import increment_ack_and_broadcast
BroadcastFn = Callable[..., Any]
from app.services.messages import BroadcastFn, increment_ack_and_broadcast
async def apply_dm_ack_code(ack_code: str, *, broadcast_fn: BroadcastFn) -> bool:
+2 -4
View File
@@ -1,9 +1,8 @@
import asyncio
import logging
import time
from collections.abc import Callable
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any
from typing import TYPE_CHECKING
from app.models import CONTACT_TYPE_REPEATER, CONTACT_TYPE_ROOM, Contact, ContactUpsert, Message
from app.repository import (
@@ -14,6 +13,7 @@ from app.repository import (
)
from app.services.contact_reconciliation import claim_prefix_messages_for_contact
from app.services.messages import (
BroadcastFn,
broadcast_message,
build_message_model,
build_message_paths,
@@ -27,8 +27,6 @@ if TYPE_CHECKING:
from app.decoder import DecryptedDirectMessage
logger = logging.getLogger(__name__)
BroadcastFn = Callable[..., Any]
_decrypted_dm_store_lock = asyncio.Lock()
+1 -2
View File
@@ -20,6 +20,7 @@ from app.repository import (
)
from app.services import dm_ack_tracker
from app.services.messages import (
BroadcastFn,
broadcast_message,
build_stored_outgoing_channel_message,
create_outgoing_channel_message,
@@ -33,8 +34,6 @@ NO_RADIO_RESPONSE_AFTER_SEND_DETAIL = (
"Send command was issued to the radio, but no response was heard back. "
"The message may or may not have sent successfully."
)
BroadcastFn = Callable[..., Any]
TrackAckFn = Callable[[str, int, int], bool]
NowFn = Callable[[], float]
OutgoingReservationKey = tuple[str, str, str]