@naturalcycles/datastore-lib 3.26.0 → 3.26.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.
@@ -10,7 +10,14 @@ const DatastoreStreamReadable_1 = require("./DatastoreStreamReadable");
10
10
  const query_util_1 = require("./query.util");
11
11
  // Datastore (also Firestore and other Google APIs) supports max 500 of items when saving/deleting, etc.
12
12
  const MAX_ITEMS = 500;
13
- const RETRY_ON = ['GOAWAY', 'UNAVAILABLE', 'UNKNOWN', 'DEADLINE_EXCEEDED', 'much contention'];
13
+ const RETRY_ON = [
14
+ 'GOAWAY',
15
+ 'UNAVAILABLE',
16
+ 'UNKNOWN',
17
+ 'DEADLINE_EXCEEDED',
18
+ 'much contention',
19
+ 'timeout',
20
+ ].map(s => s.toLowerCase());
14
21
  // Examples of errors:
15
22
  // UNKNOWN: Stream removed
16
23
  const methodMap = {
@@ -365,7 +372,7 @@ class DatastoreDB extends db_lib_1.BaseCommonDB {
365
372
  }
366
373
  getPRetryOptions(name) {
367
374
  return {
368
- predicate: err => RETRY_ON.some(s => err?.message?.includes(s)),
375
+ predicate: err => RETRY_ON.some(s => err?.message?.toLowerCase()?.includes(s)),
369
376
  name,
370
377
  timeout: 10000,
371
378
  maxAttempts: 5,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturalcycles/datastore-lib",
3
- "version": "3.26.0",
3
+ "version": "3.26.1",
4
4
  "description": "Opinionated library to work with Google Datastore",
5
5
  "scripts": {
6
6
  "prepare": "husky install"
@@ -47,7 +47,14 @@ import { dbQueryToDatastoreQuery } from './query.util'
47
47
  // Datastore (also Firestore and other Google APIs) supports max 500 of items when saving/deleting, etc.
48
48
  const MAX_ITEMS = 500
49
49
 
50
- const RETRY_ON = ['GOAWAY', 'UNAVAILABLE', 'UNKNOWN', 'DEADLINE_EXCEEDED', 'much contention']
50
+ const RETRY_ON = [
51
+ 'GOAWAY',
52
+ 'UNAVAILABLE',
53
+ 'UNKNOWN',
54
+ 'DEADLINE_EXCEEDED',
55
+ 'much contention',
56
+ 'timeout',
57
+ ].map(s => s.toLowerCase())
51
58
  // Examples of errors:
52
59
  // UNKNOWN: Stream removed
53
60
 
@@ -515,7 +522,7 @@ export class DatastoreDB extends BaseCommonDB implements CommonDB {
515
522
 
516
523
  private getPRetryOptions(name: string): PRetryOptions {
517
524
  return {
518
- predicate: err => RETRY_ON.some(s => err?.message?.includes(s)),
525
+ predicate: err => RETRY_ON.some(s => err?.message?.toLowerCase()?.includes(s)),
519
526
  name,
520
527
  timeout: 10_000,
521
528
  maxAttempts: 5,