Don't use pydantic to type-verify outgoing messages

This commit is contained in:
Matthias
2022-10-25 19:36:40 +02:00
parent 32600a113f
commit 3fa50077c9
4 changed files with 20 additions and 13 deletions

View File

@@ -75,7 +75,7 @@ async def _process_consumer_request(
# Format response
response = WSWhitelistMessage(data=whitelist)
# Send it back
await channel_manager.send_direct(channel, response)
await channel_manager.send_direct(channel, response.dict(exclude_none=True))
elif type == RPCRequestType.ANALYZED_DF:
limit = None
@@ -90,7 +90,7 @@ async def _process_consumer_request(
# For every dataframe, send as a separate message
for _, message in analyzed_df.items():
response = WSAnalyzedDFMessage(data=message)
await channel_manager.send_direct(channel, response)
await channel_manager.send_direct(channel, response.dict(exclude_none=True))
@router.websocket("/message/ws")