From ab9b8abbd2ccc7833f2b9a017662b02b743c5bc7 Mon Sep 17 00:00:00 2001 From: Izalia Mae Date: Fri, 14 Jun 2024 22:57:08 -0400 Subject: [PATCH] don't allow bytes for message in push_message --- relay/application.py | 4 ++-- relay/processors.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/relay/application.py b/relay/application.py index 25373b5..0a06b3b 100644 --- a/relay/application.py +++ b/relay/application.py @@ -139,7 +139,7 @@ class Application(web.Application): return timedelta(seconds=uptime.seconds) - def push_message(self, inbox: str, message: Message | bytes, instance: Row) -> None: + def push_message(self, inbox: str, message: Message, instance: Row) -> None: self['push_queue'].put((inbox, message, instance)) @@ -291,7 +291,7 @@ class CacheCleanupThread(Thread): class PushWorker(multiprocessing.Process): - def __init__(self, queue: multiprocessing.Queue[tuple[str, Message | bytes, Row]]) -> None: + def __init__(self, queue: multiprocessing.Queue[tuple[str, Message, Row]]) -> None: if Application.DEFAULT is None: raise RuntimeError('Application not setup yet') diff --git a/relay/processors.py b/relay/processors.py index 910ecf3..5965216 100644 --- a/relay/processors.py +++ b/relay/processors.py @@ -54,7 +54,7 @@ async def handle_forward(view: ActorView, conn: Connection) -> None: logging.debug('>> forward: %s', message) for instance in conn.distill_inboxes(view.message): - view.app.push_message(instance["inbox"], await view.request.read(), instance) + view.app.push_message(instance["inbox"], view.message, instance) view.cache.set('handle-relay', view.message.id, message.id, 'str')