Socket
Socket
Sign inDemoInstall

sqs-consumer

Package Overview
Dependencies
Maintainers
1
Versions
101
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sqs-consumer - npm Package Compare versions

Comparing version 5.0.0 to 5.0.1

2

dist/consumer.d.ts

@@ -34,3 +34,3 @@ import * as SQS from 'aws-sdk/clients/sqs';

static create(options: ConsumerOptions): Consumer;
start(): Promise<void>;
start(): void;
stop(): void;

@@ -37,0 +37,0 @@ private handleSqsResponse;

@@ -73,7 +73,7 @@ "use strict";

}
async start() {
start() {
if (this.stopped) {
debug('Starting consumer');
this.stopped = false;
await this.poll();
this.poll();
}

@@ -97,3 +97,2 @@ }

}
await this.poll();
}

@@ -192,3 +191,3 @@ async processMessage(message) {

}
async poll() {
poll() {
if (this.stopped) {

@@ -199,23 +198,25 @@ this.emit('stopped');

debug('Polling for messages');
try {
const receiveParams = {
QueueUrl: this.queueUrl,
AttributeNames: this.attributeNames,
MessageAttributeNames: this.messageAttributeNames,
MaxNumberOfMessages: this.batchSize,
WaitTimeSeconds: this.waitTimeSeconds,
VisibilityTimeout: this.visibilityTimeout
};
const response = await this.receiveMessage(receiveParams);
await this.handleSqsResponse(response);
}
catch (err) {
const receiveParams = {
QueueUrl: this.queueUrl,
AttributeNames: this.attributeNames,
MessageAttributeNames: this.messageAttributeNames,
MaxNumberOfMessages: this.batchSize,
WaitTimeSeconds: this.waitTimeSeconds,
VisibilityTimeout: this.visibilityTimeout
};
this.receiveMessage(receiveParams)
.then(this.handleSqsResponse)
.then(() => {
this.poll();
})
.catch((err) => {
this.emit('error', err);
if (isAuthenticationError(err)) {
debug('There was an authentication error. Pausing before retrying.');
setTimeout(async () => this.poll(), await this.authenticationErrorTimeout);
setTimeout(this.poll, this.authenticationErrorTimeout);
}
}
return;
});
}
}
exports.Consumer = Consumer;
{
"name": "sqs-consumer",
"version": "5.0.0",
"version": "5.0.1",
"description": "Build SQS-based Node applications without the boilerplate",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -126,7 +126,7 @@ const debug = require('debug')('sqs-consumer');

public async start(): Promise<void> {
public start(): void {
if (this.stopped) {
debug('Starting consumer');
this.stopped = false;
await this.poll();
this.poll();
}

@@ -152,4 +152,2 @@ }

}
await this.poll();
}

@@ -249,3 +247,3 @@

private async poll(): Promise<void> {
private poll(): void {
if (this.stopped) {

@@ -257,23 +255,25 @@ this.emit('stopped');

debug('Polling for messages');
try {
const receiveParams = {
QueueUrl: this.queueUrl,
AttributeNames: this.attributeNames,
MessageAttributeNames: this.messageAttributeNames,
MaxNumberOfMessages: this.batchSize,
WaitTimeSeconds: this.waitTimeSeconds,
VisibilityTimeout: this.visibilityTimeout
};
const receiveParams = {
QueueUrl: this.queueUrl,
AttributeNames: this.attributeNames,
MessageAttributeNames: this.messageAttributeNames,
MaxNumberOfMessages: this.batchSize,
WaitTimeSeconds: this.waitTimeSeconds,
VisibilityTimeout: this.visibilityTimeout
};
const response = await this.receiveMessage(receiveParams);
await this.handleSqsResponse(response);
} catch (err) {
this.emit('error', err);
if (isAuthenticationError(err)) {
debug('There was an authentication error. Pausing before retrying.');
setTimeout(async () => this.poll(), await this.authenticationErrorTimeout);
}
}
this.receiveMessage(receiveParams)
.then(this.handleSqsResponse)
.then(() => {
this.poll();
})
.catch((err) => {
this.emit('error', err);
if (isAuthenticationError(err)) {
debug('There was an authentication error. Pausing before retrying.');
setTimeout(this.poll, this.authenticationErrorTimeout);
}
return;
});
}
}

@@ -7,3 +7,3 @@ import { assert } from 'chai';

const sandbox = sinon.sandbox.create();
const sandbox = sinon.createSandbox();

@@ -10,0 +10,0 @@ const AUTHENTICATION_ERROR_TIMEOUT = 20;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc