don't allow bytes for message in push_message

This commit is contained in:
Izalia Mae 2024-06-14 22:57:08 -04:00
parent 15882f3e49
commit ab9b8abbd2
2 changed files with 3 additions and 3 deletions

View file

@ -139,7 +139,7 @@ class Application(web.Application):
return timedelta(seconds=uptime.seconds) 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)) self['push_queue'].put((inbox, message, instance))
@ -291,7 +291,7 @@ class CacheCleanupThread(Thread):
class PushWorker(multiprocessing.Process): 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: if Application.DEFAULT is None:
raise RuntimeError('Application not setup yet') raise RuntimeError('Application not setup yet')

View file

@ -54,7 +54,7 @@ async def handle_forward(view: ActorView, conn: Connection) -> None:
logging.debug('>> forward: %s', message) logging.debug('>> forward: %s', message)
for instance in conn.distill_inboxes(view.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') view.cache.set('handle-relay', view.message.id, message.id, 'str')