@naturalcycles/datastore-lib 4.18.4 → 4.18.6

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.
@@ -75,11 +75,11 @@ export class DatastoreStreamReadable extends Readable {
75
75
  // console.log(`_read called ${++this.count}, wasRunning: ${this.running}`) // debugging
76
76
  this.countReads++;
77
77
  if (this.done) {
78
- this.logger.warn(`!!! _read was called, but done==true`);
78
+ this.logger.warn(`!!! ${this.table} _read was called, but done==true`);
79
79
  return;
80
80
  }
81
81
  if (this.paused) {
82
- this.logger.log(`_read #${this.countReads}, queryIsRunning: ${this.queryIsRunning}, unpausing stream`);
82
+ this.logger.debug(`_read #${this.countReads}, queryIsRunning: ${this.queryIsRunning}, unpausing stream`);
83
83
  this.paused = false;
84
84
  }
85
85
  if (this.queryIsRunning) {
@@ -118,7 +118,7 @@ export class DatastoreStreamReadable extends Readable {
118
118
  const rows = res[0];
119
119
  const info = res[1];
120
120
  this.rowsRetrieved += rows.length;
121
- logger.log(`${table} got ${rows.length} rows in ${_ms(queryTook)}, ${this.rowsRetrieved} rowsRetrieved, totalWait: ${_ms(this.totalWait)}`);
121
+ logger.debug(`${table} got ${rows.length} rows in ${_ms(queryTook)}, ${this.rowsRetrieved} rowsRetrieved, totalWait: ${_ms(this.totalWait)}`);
122
122
  this.endCursor = info.endCursor;
123
123
  this.queryIsRunning = false; // ready to take more _reads
124
124
  this.lastQueryDone = Date.now();
@@ -129,7 +129,7 @@ export class DatastoreStreamReadable extends Readable {
129
129
  if (!info.endCursor ||
130
130
  info.moreResults === 'NO_MORE_RESULTS' ||
131
131
  (this.originalLimit && this.rowsRetrieved >= this.originalLimit)) {
132
- logger.log(`!!!! DONE! ${this.rowsRetrieved} rowsRetrieved, totalWait: ${_ms(this.totalWait)}`);
132
+ logger.log(`${table} stream is done, ${this.rowsRetrieved} rowsRetrieved, totalWait: ${_ms(this.totalWait)}`);
133
133
  this.push(null);
134
134
  this.done = true;
135
135
  this.paused = false;
@@ -147,7 +147,7 @@ export class DatastoreStreamReadable extends Readable {
147
147
  logger.debug(`${table} stream is already paused`);
148
148
  }
149
149
  else {
150
- logger.log(`${table} pausing the stream`);
150
+ logger.debug(`${table} pausing the stream`);
151
151
  this.paused = true;
152
152
  }
153
153
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@naturalcycles/datastore-lib",
3
3
  "type": "module",
4
- "version": "4.18.4",
4
+ "version": "4.18.6",
5
5
  "description": "Opinionated library to work with Google Datastore, implements CommonDB",
6
6
  "dependencies": {
7
7
  "@google-cloud/datastore": "^10",
@@ -103,12 +103,12 @@ export class DatastoreStreamReadable<T = any> extends Readable implements Readab
103
103
  this.countReads++
104
104
 
105
105
  if (this.done) {
106
- this.logger.warn(`!!! _read was called, but done==true`)
106
+ this.logger.warn(`!!! ${this.table} _read was called, but done==true`)
107
107
  return
108
108
  }
109
109
 
110
110
  if (this.paused) {
111
- this.logger.log(
111
+ this.logger.debug(
112
112
  `_read #${this.countReads}, queryIsRunning: ${this.queryIsRunning}, unpausing stream`,
113
113
  )
114
114
  this.paused = false
@@ -158,7 +158,7 @@ export class DatastoreStreamReadable<T = any> extends Readable implements Readab
158
158
  const info: RunQueryInfo = res[1]
159
159
 
160
160
  this.rowsRetrieved += rows.length
161
- logger.log(
161
+ logger.debug(
162
162
  `${table} got ${rows.length} rows in ${_ms(queryTook)}, ${this.rowsRetrieved} rowsRetrieved, totalWait: ${_ms(
163
163
  this.totalWait,
164
164
  )}`,
@@ -179,7 +179,7 @@ export class DatastoreStreamReadable<T = any> extends Readable implements Readab
179
179
  (this.originalLimit && this.rowsRetrieved >= this.originalLimit)
180
180
  ) {
181
181
  logger.log(
182
- `!!!! DONE! ${this.rowsRetrieved} rowsRetrieved, totalWait: ${_ms(this.totalWait)}`,
182
+ `${table} stream is done, ${this.rowsRetrieved} rowsRetrieved, totalWait: ${_ms(this.totalWait)}`,
183
183
  )
184
184
  this.push(null)
185
185
  this.done = true
@@ -197,7 +197,7 @@ export class DatastoreStreamReadable<T = any> extends Readable implements Readab
197
197
  if (this.paused) {
198
198
  logger.debug(`${table} stream is already paused`)
199
199
  } else {
200
- logger.log(`${table} pausing the stream`)
200
+ logger.debug(`${table} pausing the stream`)
201
201
  this.paused = true
202
202
  }
203
203
  }