This is a fix for #175 where a consumer of an empty rabbitmq queue will see high CPU. This is due to an implementation that relied on amqplib's channel.get() that returns immediately regardless if a message is queued or not. As a result this was being called repeatedly causing the high CPU spin (evidenced by less CPU when a .sleep() was added)
This change uses .consume() instead which is callback based and only triggers when a message is available for consumption. As a result there is no repeated spinning waiting for a message.
This is a fix for #175 where a consumer of an empty rabbitmq queue will see high CPU. This is due to an implementation that relied on amqplib's
channel.get()
that returns immediately regardless if a message is queued or not. As a result this was being called repeatedly causing the high CPU spin (evidenced by less CPU when a .sleep() was added)This change uses
.consume()
instead which is callback based and only triggers when a message is available for consumption. As a result there is no repeated spinning waiting for a message.