Skip to content

Commit 331e95b

Browse files
committed
[misc] debug: fix network logger cleanup and test range adjustment
1 parent 42f1cea commit 331e95b

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

lib/connection.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ class Connection extends EventEmitter {
708708
const quitCmd = new Quit(cmdParam, ended, ended);
709709
this.sendQueue.push(quitCmd);
710710
this.receiveQueue.push(quitCmd);
711-
711+
712712
// Deno compatibility: send QUIT immediately to avoid socket resource cleanup issues
713713
const isDeno = typeof Deno !== 'undefined';
714714
if (this.sendQueue.length === 1) {
@@ -843,7 +843,11 @@ class Connection extends EventEmitter {
843843
*/
844844
debug(val) {
845845
if (typeof val === 'boolean') {
846-
if (val && !this.opts.logger.network) this.opts.logger.network = console.log;
846+
if (val) {
847+
if (!this.opts.logger.network) this.opts.logger.network = console.log;
848+
} else {
849+
this.opts.logger.network = null;
850+
}
847851
} else if (typeof val === 'function') {
848852
this.opts.logger.network = val;
849853
}

test/integration/debug.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ describe.sequential('debug', () => {
100100
const serverVersion = conn.serverVersion();
101101
if (isMaxscale(shareConn)) compress = false;
102102
const rangeWithEOF = compress ? [1500, 2000] : [1800, 4250];
103-
const rangeWithoutEOF = compress ? [1500, 2000] : [2350, 3250];
103+
const rangeWithoutEOF = compress ? [1500, 3000] : [2350, 3250];
104104
const data = fs.readFileSync(path.join(os.tmpdir(), 'combined' + fileIncrement + '.txt'), 'utf8');
105105
console.log(data);
106106
assert.isTrue(data.includes('QUERY: SELECT 3'));

0 commit comments

Comments
 (0)