hivesolutions / appier

Joyful Python Web App development
http://appier.hive.pt
Apache License 2.0
127 stars 22 forks source link

Make use of add_callback_threadsafe #40

Closed joao-conde closed 4 years ago

joao-conde commented 4 years ago

This comment by one of the Pika's maintainers sums it up. Essentially, Pika is not thread-safe. Messages should not be published from a different thread than the one running Pika's I/O loop. Hence, the method publishing messages should use the add_callback_threadsafe method on the connection to schedule a function (that would publish a message) to execute on the correct thread.

Documentation on the method: BlockingConnection.add_callback_threadsafe

@joamag

coveralls commented 4 years ago

Coverage Status

Coverage increased (+0.0006%) to 63.902% when pulling 95e6c55490c3bcc2af9b25d61ad8d972d9007bc3 on joao-conde:master into 5f5f41b1d43084f815c8c3b8511f556f2a34c78d on hivesolutions:master.