-
Notifications
You must be signed in to change notification settings - Fork 38
Closed
Description
version: 2.10.7
I'm using the library in multithreading and I get the occasional KeyError
.
I replicated the problem after troubleshooting and minimal units.
import threading
import amqpstorm
connection = amqpstorm.Connection(hostname="localhost",
port=5672,
username="admin",
password="admin", )
channel = connection.channel()
queues = ["demo1", "demo2", "demo3"]
for queue in queues:
channel.queue.declare(queue, durable=True)
for i in range(100):
channel.basic.publish(f"{i}", queue)
def start_consuming(queue):
channel.basic.qos(prefetch_count=1)
channel.basic.consume(
queue=queue, callback=lambda x: x, no_ack=False
)
channel.start_consuming(to_tuple=False)
for queue in queues:
t = threading.Thread(target=start_consuming, args=(queue,))
t.start()
I forked the project and tried to fix it. see commit
But I think there may be a more appropriate solution