midknight41 / easy-sqs

Simplified Library for using AWS Simple Queuing Service (SQS)
MIT License
9 stars 7 forks source link

calling consumer.start() twice should only start once. #27

Open teebu opened 3 years ago

teebu commented 3 years ago
let consumer = client.createQueueReader(sqsEndpoint.url, 1); // batch size: 1
console.log('starting sqs consumers:', consumer.queueName);
consumer.start();
consumer.start();

starts the consumer twice, double the events.

The simple solution would be to check if its already listening.

if (!consumer.listening) consumer.start();