File tree 2 files changed +13
-8
lines changed 2 files changed +13
-8
lines changed Original file line number Diff line number Diff line change 17
17
* limitations under the License.
18
18
*/
19
19
20
- import { ServerAddress } from " ./internal/server-address"
20
+ import { ServerAddress } from ' ./internal/server-address'
21
21
22
22
/**
23
23
* Interface which defines the raw connection with the database
Original file line number Diff line number Diff line change @@ -124,7 +124,9 @@ class Session {
124
124
this . _transactionExecutor = _createTransactionExecutor ( config )
125
125
this . _onComplete = this . _onCompleteCallback . bind ( this )
126
126
this . _databaseNameResolved = this . _database !== ''
127
- this . _setupWatermark ( )
127
+ const calculatedWatermaks = this . _calculateWatermaks ( )
128
+ this . _lowRecordWatermark = calculatedWatermaks . low
129
+ this . _highRecordWatermark = calculatedWatermaks . high
128
130
}
129
131
130
132
/**
@@ -431,13 +433,16 @@ class Session {
431
433
* @private
432
434
* @returns {void }
433
435
*/
434
- private _setupWatermark ( ) : void {
436
+ private _calculateWatermaks ( ) : { low : number ; high : number } {
435
437
if ( this . _fetchSize === FETCH_ALL ) {
436
- this . _lowRecordWatermark = Number . MAX_VALUE // we shall always lower than this number to enable auto pull
437
- this . _highRecordWatermark = Number . MAX_VALUE // we shall never reach this number to disable auto pull
438
- } else {
439
- this . _lowRecordWatermark = 0.3 * this . _fetchSize
440
- this . _highRecordWatermark = 0.7 * this . _fetchSize
438
+ return {
439
+ low : Number . MAX_VALUE , // we shall always lower than this number to enable auto pull
440
+ high : Number . MAX_VALUE // we shall never reach this number to disable auto pull
441
+ }
442
+ }
443
+ return {
444
+ low : 0.3 * this . _fetchSize ,
445
+ high : 0.7 * this . _fetchSize
441
446
}
442
447
}
443
448
You can’t perform that action at this time.
0 commit comments