taskiq-python / taskiq

Distributed task queue with full async support
MIT License
872 stars 53 forks source link

fix ZeroMQBroker #378

Closed yudytskiy closed 1 week ago

yudytskiy commented 1 week ago

In kick method we must connect to pub like:

async def kick(self, message: BrokerMessage) -> None:
    """
    Kicking message.

    This method is used to publish message
    via socket.

    :param message: message to publish.
    """
    part_len = 100
    parts = [
        message.message[
            idx * part_len : min(idx * part_len + part_len, len(message.message))
        ]
        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)