@naturalcycles/datastore-lib 4.19.0 → 4.19.1
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.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Readable } from 'node:stream';
|
|
2
2
|
import { localTime } from '@naturalcycles/js-lib/datetime/localTime.js';
|
|
3
3
|
import { _ms } from '@naturalcycles/js-lib/datetime/time.util.js';
|
|
4
|
+
import { TimeoutError } from '@naturalcycles/js-lib/error';
|
|
4
5
|
import { createCommonLoggerAtLevel } from '@naturalcycles/js-lib/log';
|
|
5
6
|
import { pRetry } from '@naturalcycles/js-lib/promise/pRetry.js';
|
|
6
7
|
import { getRunQueryOptions } from './query.util.js';
|
|
@@ -159,7 +160,8 @@ export class DatastoreStreamReadable extends Readable {
|
|
|
159
160
|
return await q.run(this.dsOpt);
|
|
160
161
|
}, {
|
|
161
162
|
name: `DatastoreStreamReadable.query(${table})`,
|
|
162
|
-
predicate: err =>
|
|
163
|
+
predicate: err => err instanceof TimeoutError ||
|
|
164
|
+
RETRY_ON.some(s => err?.message?.toLowerCase()?.includes(s)),
|
|
163
165
|
maxAttempts: 5,
|
|
164
166
|
delay: 5000,
|
|
165
167
|
delayMultiplier: 2,
|
package/package.json
CHANGED
|
@@ -7,6 +7,7 @@ import type {
|
|
|
7
7
|
} from '@google-cloud/datastore/build/src/query.js'
|
|
8
8
|
import { localTime } from '@naturalcycles/js-lib/datetime/localTime.js'
|
|
9
9
|
import { _ms } from '@naturalcycles/js-lib/datetime/time.util.js'
|
|
10
|
+
import { TimeoutError } from '@naturalcycles/js-lib/error'
|
|
10
11
|
import { createCommonLoggerAtLevel } from '@naturalcycles/js-lib/log'
|
|
11
12
|
import type { CommonLogger } from '@naturalcycles/js-lib/log'
|
|
12
13
|
import { pRetry } from '@naturalcycles/js-lib/promise/pRetry.js'
|
|
@@ -214,7 +215,9 @@ export class DatastoreStreamReadable<T = any> extends Readable implements Readab
|
|
|
214
215
|
},
|
|
215
216
|
{
|
|
216
217
|
name: `DatastoreStreamReadable.query(${table})`,
|
|
217
|
-
predicate: err =>
|
|
218
|
+
predicate: err =>
|
|
219
|
+
err instanceof TimeoutError ||
|
|
220
|
+
RETRY_ON.some(s => err?.message?.toLowerCase()?.includes(s)),
|
|
218
221
|
maxAttempts: 5,
|
|
219
222
|
delay: 5000,
|
|
220
223
|
delayMultiplier: 2,
|