From b0adba6abcf52a58cc510dbd85ef6b744ed57f24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Arturo=20Cabral=20Mej=C3=ADa?= Date: Fri, 27 Jan 2023 19:23:06 -0500 Subject: [PATCH] fix: patch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ricardo Arturo Cabral Mejía --- src/adapters/web-socket-server-adapter.ts | 3 +++ src/database/client.ts | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/adapters/web-socket-server-adapter.ts b/src/adapters/web-socket-server-adapter.ts index 88672ce4..8600272b 100644 --- a/src/adapters/web-socket-server-adapter.ts +++ b/src/adapters/web-socket-server-adapter.ts @@ -72,6 +72,9 @@ export class WebSocketServerAdapter extends WebServerAdapter implements IWebSock return } const webSocketAdapter = this.webSocketsAdapters.get(webSocket) as IWebSocketAdapter + if (!webSocketAdapter) { + return + } webSocketAdapter.emit(WebSocketAdapterEvent.Event, event) }) } diff --git a/src/database/client.ts b/src/database/client.ts index e03b594c..ac2fda8f 100644 --- a/src/database/client.ts +++ b/src/database/client.ts @@ -3,6 +3,19 @@ import 'pg-query-stream' import knex, { Knex } from 'knex' import { createLogger } from '../factories/logger-factory' +knex.Client.prototype.releaseConnection = function (connection) { + //debug('releasing connection to pool: %s', connection.__knexUid); + console.log('releasing connection to pool') + const didRelease = this.pool.release(connection) + + if (!didRelease) { + console.log('pool refused connection') + //debug('pool refused connection: %s', connection.__knexUid); + } + + return Promise.resolve() +} + const getMasterConfig = (): Knex.Config => ({ client: 'pg', connection: {