presidium 3.4.5 → 3.4.7

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/DynamoDBStream.js CHANGED
@@ -15,6 +15,7 @@ const dynamoDBStreamGetShardsIterator =
15
15
  require('./internal/dynamoDBStreamGetShardsIterator')
16
16
  const dynamoDBStreamGetRecordsIterator =
17
17
  require('./internal/dynamoDBStreamGetRecordsIterator')
18
+ const AwsError = require('./internal/AwsError')
18
19
 
19
20
  const SymbolUpdateShards = Symbol('UpdateShards')
20
21
 
@@ -100,6 +101,7 @@ class DynamoDBStream {
100
101
  this.StreamViewType = options.StreamViewType ?? 'NEW_AND_OLD_IMAGES'
101
102
  this.ShardIteratorType = options.ShardIteratorType ?? 'LATEST'
102
103
  this.GetRecordsLimit = options.GetRecordsLimit ?? 1000
104
+ this.GetStreamsInterval = options.GetStreamsInterval ?? 1000
103
105
  this.GetShardsInterval = options.GetShardsInterval ?? 1000
104
106
  this.GetRecordsInterval = options.GetRecordsInterval ?? 1000
105
107
  this.ShardUpdatePeriod = options.ShardUpdatePeriod ?? 15000
@@ -1,3 +1,5 @@
1
+ const sleep = require('./sleep')
2
+
1
3
  /**
2
4
  * @name RetryAwsErrors
3
5
  *
@@ -9,8 +11,10 @@
9
11
 
10
12
  const RetryAwsErrors = function (func, context, name) {
11
13
  return function retriesAwsErrors(...args) {
12
- return func.apply(context, args).catch(error => {
14
+ return func.apply(context, args).catch(async error => {
13
15
  if (error.retryable) {
16
+ console.error(error)
17
+ await sleep(1000)
14
18
  return retriesAwsErrors(...args)
15
19
  }
16
20
  throw error
@@ -1,6 +1,7 @@
1
1
  require('rubico/global')
2
2
  const RetryAwsErrors = require('./RetryAwsErrors')
3
3
  const dynamoDBStreamDescribeStream = require('./dynamoDBStreamDescribeStream')
4
+ const sleep = require('./sleep')
4
5
 
5
6
  /**
6
7
  * @name dynamoDBStreamGetShardsIterator
@@ -1,5 +1,6 @@
1
1
  const RetryAwsErrors = require('./RetryAwsErrors')
2
2
  const dynamoDBStreamListStreams = require('./dynamoDBStreamListStreams')
3
+ const sleep = require('./sleep')
3
4
 
4
5
  /**
5
6
  * @name dynamoDBStreamGetStreamsIterator
@@ -20,7 +21,10 @@ async function* dynamoDBStreamGetStreamsIterator() {
20
21
  })
21
22
 
22
23
  yield* streams.Streams
24
+
23
25
  while (!this.closed && streams.LastEvaluatedStreamArn != null) {
26
+ await sleep(this.GetStreamsInterval)
27
+
24
28
  streams = await dynamoDBStreamListStreamsRetries({
25
29
  Limit: this.ListStreamsLimit,
26
30
  TableName: this.table,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "presidium",
3
- "version": "3.4.5",
3
+ "version": "3.4.7",
4
4
  "description": "A library for creating web services",
5
5
  "author": "Richard Tong",
6
6
  "license": "MIT",