@naturalcycles/datastore-lib 3.39.0 → 3.39.2
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.
|
@@ -20,7 +20,7 @@ export declare class DatastoreStreamReadable<T = any> extends Readable implement
|
|
|
20
20
|
private lastReadTimestamp;
|
|
21
21
|
private readonly maxWaitInterval;
|
|
22
22
|
private readonly opt;
|
|
23
|
-
private dsOpt;
|
|
23
|
+
private readonly dsOpt;
|
|
24
24
|
constructor(q: Query, opt: DatastoreDBStreamOptions, logger: CommonLogger);
|
|
25
25
|
private runNextQuery;
|
|
26
26
|
/**
|
package/dist/datastore.db.js
CHANGED
|
@@ -11,7 +11,7 @@ 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
13
|
// It's an empyrical value, but anything less than infinity is better than infinity
|
|
14
|
-
const DATASTORE_RECOMMENDED_CONCURRENCY =
|
|
14
|
+
const DATASTORE_RECOMMENDED_CONCURRENCY = 8;
|
|
15
15
|
const RETRY_ON = [
|
|
16
16
|
'GOAWAY',
|
|
17
17
|
'UNAVAILABLE',
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Readable } from 'node:stream'
|
|
2
2
|
import { Query } from '@google-cloud/datastore'
|
|
3
3
|
import type { RunQueryInfo, RunQueryOptions } from '@google-cloud/datastore/build/src/query'
|
|
4
|
-
import { _ms, CommonLogger, pRetry,
|
|
4
|
+
import { _ms, CommonLogger, pRetry, UnixTimestampMillis } from '@naturalcycles/js-lib'
|
|
5
5
|
import type { ReadableTyped } from '@naturalcycles/nodejs-lib'
|
|
6
6
|
import type { DatastoreDBStreamOptions } from './datastore.model'
|
|
7
7
|
|
|
@@ -17,11 +17,11 @@ export class DatastoreStreamReadable<T = any> extends Readable implements Readab
|
|
|
17
17
|
/**
|
|
18
18
|
* Used to support maxWait
|
|
19
19
|
*/
|
|
20
|
-
private lastReadTimestamp
|
|
20
|
+
private lastReadTimestamp = 0 as UnixTimestampMillis
|
|
21
21
|
private readonly maxWaitInterval: NodeJS.Timeout | undefined
|
|
22
22
|
|
|
23
23
|
private readonly opt: DatastoreDBStreamOptions & { batchSize: number }
|
|
24
|
-
private dsOpt: RunQueryOptions
|
|
24
|
+
private readonly dsOpt: RunQueryOptions
|
|
25
25
|
|
|
26
26
|
constructor(
|
|
27
27
|
private q: Query,
|
|
@@ -187,7 +187,7 @@ export class DatastoreStreamReadable<T = any> extends Readable implements Readab
|
|
|
187
187
|
count = 0
|
|
188
188
|
|
|
189
189
|
override _read(): void {
|
|
190
|
-
this.lastReadTimestamp = Date.now()
|
|
190
|
+
this.lastReadTimestamp = Date.now() as UnixTimestampMillis
|
|
191
191
|
|
|
192
192
|
// console.log(`_read called ${++this.count}, wasRunning: ${this.running}`) // debugging
|
|
193
193
|
this.count++
|
package/src/datastore.db.ts
CHANGED
|
@@ -54,7 +54,7 @@ import { dbQueryToDatastoreQuery } from './query.util'
|
|
|
54
54
|
// Datastore (also Firestore and other Google APIs) supports max 500 of items when saving/deleting, etc.
|
|
55
55
|
const MAX_ITEMS = 500
|
|
56
56
|
// It's an empyrical value, but anything less than infinity is better than infinity
|
|
57
|
-
const DATASTORE_RECOMMENDED_CONCURRENCY =
|
|
57
|
+
const DATASTORE_RECOMMENDED_CONCURRENCY = 8
|
|
58
58
|
|
|
59
59
|
const RETRY_ON = [
|
|
60
60
|
'GOAWAY',
|