sqs-consumer 11.1.0 → 11.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -6
- package/dist/cjs/consumer.js +10 -4
- package/dist/cjs/types.d.ts +3 -2
- package/dist/esm/consumer.js +10 -4
- package/dist/esm/types.d.ts +3 -2
- package/package.json +1 -1
- package/src/consumer.ts +13 -5
- package/src/types.ts +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
## [11.
|
|
1
|
+
## [11.2.0](https://github.com/bbc/sqs-consumer/compare/v11.1.0...v11.2.0) (2024-10-19)
|
|
2
2
|
|
|
3
3
|
### Features
|
|
4
4
|
|
|
5
|
-
*
|
|
6
|
-
|
|
7
|
-
### Chores
|
|
8
|
-
|
|
9
|
-
* removing aws sdk v2 note ([#519](https://github.com/bbc/sqs-consumer/issues/519)) ([7609799](https://github.com/bbc/sqs-consumer/commit/76097991a3679eeb8375620235448536b7653b66))
|
|
5
|
+
* allows a number to be entered in terminateVisibilityTimeout for customisation ([#520](https://github.com/bbc/sqs-consumer/issues/520)) ([e09c759](https://github.com/bbc/sqs-consumer/commit/e09c7593f524471cf25ca5b4f7592d6a625e9d33))
|
package/dist/cjs/consumer.js
CHANGED
|
@@ -260,8 +260,11 @@ class Consumer extends emitter_js_1.TypedEventEmitter {
|
|
|
260
260
|
}
|
|
261
261
|
catch (err) {
|
|
262
262
|
this.emitError(err, message);
|
|
263
|
-
if (this.terminateVisibilityTimeout) {
|
|
264
|
-
|
|
263
|
+
if (this.terminateVisibilityTimeout !== false) {
|
|
264
|
+
const timeout = this.terminateVisibilityTimeout === true
|
|
265
|
+
? 0
|
|
266
|
+
: this.terminateVisibilityTimeout;
|
|
267
|
+
await this.changeVisibilityTimeout(message, timeout);
|
|
265
268
|
}
|
|
266
269
|
}
|
|
267
270
|
finally {
|
|
@@ -293,8 +296,11 @@ class Consumer extends emitter_js_1.TypedEventEmitter {
|
|
|
293
296
|
}
|
|
294
297
|
catch (err) {
|
|
295
298
|
this.emit("error", err, messages);
|
|
296
|
-
if (this.terminateVisibilityTimeout) {
|
|
297
|
-
|
|
299
|
+
if (this.terminateVisibilityTimeout !== false) {
|
|
300
|
+
const timeout = this.terminateVisibilityTimeout === true
|
|
301
|
+
? 0
|
|
302
|
+
: this.terminateVisibilityTimeout;
|
|
303
|
+
await this.changeVisibilityTimeoutBatch(messages, timeout);
|
|
298
304
|
}
|
|
299
305
|
}
|
|
300
306
|
finally {
|
package/dist/cjs/types.d.ts
CHANGED
|
@@ -60,10 +60,11 @@ export interface ConsumerOptions {
|
|
|
60
60
|
*/
|
|
61
61
|
pollingCompleteWaitTimeMs?: number;
|
|
62
62
|
/**
|
|
63
|
-
* If true, sets the message visibility timeout to 0 after a `processing_error`.
|
|
63
|
+
* If true, sets the message visibility timeout to 0 after a `processing_error`. You can
|
|
64
|
+
* also specify a different timeout using a number.
|
|
64
65
|
* @defaultvalue `false`
|
|
65
66
|
*/
|
|
66
|
-
terminateVisibilityTimeout?: boolean;
|
|
67
|
+
terminateVisibilityTimeout?: boolean | number;
|
|
67
68
|
/**
|
|
68
69
|
* The interval (in seconds) between requests to extend the message visibility timeout.
|
|
69
70
|
*
|
package/dist/esm/consumer.js
CHANGED
|
@@ -257,8 +257,11 @@ export class Consumer extends TypedEventEmitter {
|
|
|
257
257
|
}
|
|
258
258
|
catch (err) {
|
|
259
259
|
this.emitError(err, message);
|
|
260
|
-
if (this.terminateVisibilityTimeout) {
|
|
261
|
-
|
|
260
|
+
if (this.terminateVisibilityTimeout !== false) {
|
|
261
|
+
const timeout = this.terminateVisibilityTimeout === true
|
|
262
|
+
? 0
|
|
263
|
+
: this.terminateVisibilityTimeout;
|
|
264
|
+
await this.changeVisibilityTimeout(message, timeout);
|
|
262
265
|
}
|
|
263
266
|
}
|
|
264
267
|
finally {
|
|
@@ -290,8 +293,11 @@ export class Consumer extends TypedEventEmitter {
|
|
|
290
293
|
}
|
|
291
294
|
catch (err) {
|
|
292
295
|
this.emit("error", err, messages);
|
|
293
|
-
if (this.terminateVisibilityTimeout) {
|
|
294
|
-
|
|
296
|
+
if (this.terminateVisibilityTimeout !== false) {
|
|
297
|
+
const timeout = this.terminateVisibilityTimeout === true
|
|
298
|
+
? 0
|
|
299
|
+
: this.terminateVisibilityTimeout;
|
|
300
|
+
await this.changeVisibilityTimeoutBatch(messages, timeout);
|
|
295
301
|
}
|
|
296
302
|
}
|
|
297
303
|
finally {
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -60,10 +60,11 @@ export interface ConsumerOptions {
|
|
|
60
60
|
*/
|
|
61
61
|
pollingCompleteWaitTimeMs?: number;
|
|
62
62
|
/**
|
|
63
|
-
* If true, sets the message visibility timeout to 0 after a `processing_error`.
|
|
63
|
+
* If true, sets the message visibility timeout to 0 after a `processing_error`. You can
|
|
64
|
+
* also specify a different timeout using a number.
|
|
64
65
|
* @defaultvalue `false`
|
|
65
66
|
*/
|
|
66
|
-
terminateVisibilityTimeout?: boolean;
|
|
67
|
+
terminateVisibilityTimeout?: boolean | number;
|
|
67
68
|
/**
|
|
68
69
|
* The interval (in seconds) between requests to extend the message visibility timeout.
|
|
69
70
|
*
|
package/package.json
CHANGED
package/src/consumer.ts
CHANGED
|
@@ -51,7 +51,7 @@ export class Consumer extends TypedEventEmitter {
|
|
|
51
51
|
private alwaysAcknowledge: boolean;
|
|
52
52
|
private batchSize: number;
|
|
53
53
|
private visibilityTimeout: number;
|
|
54
|
-
private terminateVisibilityTimeout: boolean;
|
|
54
|
+
private terminateVisibilityTimeout: boolean | number;
|
|
55
55
|
private waitTimeSeconds: number;
|
|
56
56
|
private authenticationErrorTimeout: number;
|
|
57
57
|
private pollingWaitTimeMs: number;
|
|
@@ -362,8 +362,12 @@ export class Consumer extends TypedEventEmitter {
|
|
|
362
362
|
} catch (err) {
|
|
363
363
|
this.emitError(err, message);
|
|
364
364
|
|
|
365
|
-
if (this.terminateVisibilityTimeout) {
|
|
366
|
-
|
|
365
|
+
if (this.terminateVisibilityTimeout !== false) {
|
|
366
|
+
const timeout =
|
|
367
|
+
this.terminateVisibilityTimeout === true
|
|
368
|
+
? 0
|
|
369
|
+
: this.terminateVisibilityTimeout;
|
|
370
|
+
await this.changeVisibilityTimeout(message, timeout);
|
|
367
371
|
}
|
|
368
372
|
} finally {
|
|
369
373
|
if (this.heartbeatInterval) {
|
|
@@ -400,8 +404,12 @@ export class Consumer extends TypedEventEmitter {
|
|
|
400
404
|
} catch (err) {
|
|
401
405
|
this.emit("error", err, messages);
|
|
402
406
|
|
|
403
|
-
if (this.terminateVisibilityTimeout) {
|
|
404
|
-
|
|
407
|
+
if (this.terminateVisibilityTimeout !== false) {
|
|
408
|
+
const timeout =
|
|
409
|
+
this.terminateVisibilityTimeout === true
|
|
410
|
+
? 0
|
|
411
|
+
: this.terminateVisibilityTimeout;
|
|
412
|
+
await this.changeVisibilityTimeoutBatch(messages, timeout);
|
|
405
413
|
}
|
|
406
414
|
} finally {
|
|
407
415
|
clearInterval(heartbeatTimeoutId);
|
package/src/types.ts
CHANGED
|
@@ -66,10 +66,11 @@ export interface ConsumerOptions {
|
|
|
66
66
|
*/
|
|
67
67
|
pollingCompleteWaitTimeMs?: number;
|
|
68
68
|
/**
|
|
69
|
-
* If true, sets the message visibility timeout to 0 after a `processing_error`.
|
|
69
|
+
* If true, sets the message visibility timeout to 0 after a `processing_error`. You can
|
|
70
|
+
* also specify a different timeout using a number.
|
|
70
71
|
* @defaultvalue `false`
|
|
71
72
|
*/
|
|
72
|
-
terminateVisibilityTimeout?: boolean;
|
|
73
|
+
terminateVisibilityTimeout?: boolean | number;
|
|
73
74
|
/**
|
|
74
75
|
* The interval (in seconds) between requests to extend the message visibility timeout.
|
|
75
76
|
*
|