When the job is submitted to the QueueServer it initially reads 16 bytes to determine the header and the content length. The full request content, or even the header, may not be complete the moment the socket becomes "readable". This would raise BlockingIOError as not enough data is read from the socket. Possible solutions are using blocking sockets (maybe with some asynchronous library like gevent or asyncio) or buffering the message until it's fully complete (16 bytes header + bytes was received) and processing the request afterwards.
As for now, there was no problems. If any issues occur, changing conn.send(head + content) to conn.sendall(head + content) in QueueServer.communite should be the first thing to try.
When the job is submitted to the bytes was received) and processing the request afterwards.
QueueServer
it initially reads 16 bytes to determine the header and the content length. The full request content, or even the header, may not be complete the moment the socket becomes "readable". This would raiseBlockingIOError
as not enough data is read from the socket. Possible solutions are using blocking sockets (maybe with some asynchronous library like gevent or asyncio) or buffering the message until it's fully complete (16 bytes header +As for now, there was no problems. If any issues occur, changing
conn.send(head + content)
toconn.sendall(head + content)
inQueueServer.communite
should be the first thing to try.