Skip to content

Commit

Permalink
Fix circular import
Browse files Browse the repository at this point in the history
  • Loading branch information
Tjstretchalot committed Jan 29, 2025
1 parent f3328cd commit 05ba5a4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/lonelypss/ws/handlers/open/send_simple_asap.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
import asyncio
from typing import TYPE_CHECKING

from lonelypss.ws.handlers.open.senders.send_any import send_any
from lonelypss.ws.state import (
SimplePendingSend,
SimplePendingSendPreFormatted,
SimplePendingSendType,
StateOpen,
)

if TYPE_CHECKING:
from lonelypss.ws.handlers.open.senders.send_any import send_any
else:
send_any = None


def send_asap(state: StateOpen, pending: SimplePendingSend) -> None:
"""Queues a simple message to be sent to the subscriber as soon as possible,
where that message has already been described via one of the SimplePendingSend
options
"""
global send_any
if send_any is None:
from lonelypss.ws.handlers.open.senders.send_any import send_any

if state.send_task is None:
state.send_task = asyncio.create_task(send_any(state, pending))
Expand Down

0 comments on commit 05ba5a4

Please sign in to comment.