Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions taskiq/brokers/zmq_broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,16 @@ async def startup(self) -> None:
self.socket.bind(self.pub_host)
await super().startup()

async def shutdown(self) -> None:
"""
Shutdown for zmq broker.

This function closes actual connections to sockets
"""
if not self.is_worker_process:
self.socket.unbind()
return await super().shutdown()

async def kick(self, message: BrokerMessage) -> None:
"""
Kicking message.
Expand All @@ -77,8 +87,7 @@ async def kick(self, message: BrokerMessage) -> None:
]
for idx in range(math.ceil(len(message.message) / part_len))
]
with self.socket.connect(self.pub_host) as sock:
await sock.send_multipart(parts)
await self.socket.send_multipart(parts)

async def listen(self) -> AsyncGenerator[bytes, None]:
"""
Expand Down
Loading