Skip to content

Commit 4413891

Browse files
committed
Adjusting DenoJS compatibility
1 parent d0f8c5f commit 4413891

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

packages/core/src/connection.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* limitations under the License.
1818
*/
1919

20-
import { ServerAddress } from "./internal/server-address"
20+
import { ServerAddress } from './internal/server-address'
2121

2222
/**
2323
* Interface which defines the raw connection with the database

packages/core/src/session.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,9 @@ class Session {
124124
this._transactionExecutor = _createTransactionExecutor(config)
125125
this._onComplete = this._onCompleteCallback.bind(this)
126126
this._databaseNameResolved = this._database !== ''
127-
this._setupWatermark()
127+
const calculatedWatermaks = this._calculateWatermaks()
128+
this._lowRecordWatermark = calculatedWatermaks.low
129+
this._highRecordWatermark = calculatedWatermaks.high
128130
}
129131

130132
/**
@@ -431,13 +433,16 @@ class Session {
431433
* @private
432434
* @returns {void}
433435
*/
434-
private _setupWatermark(): void {
436+
private _calculateWatermaks(): { low: number; high: number } {
435437
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
441446
}
442447
}
443448

0 commit comments

Comments
 (0)