Skip to content

Commit 25fb476

Browse files
authored
Update PostgresClient.js (#7276)
Proper pg-monitor re-attachment logic.
1 parent 60eef47 commit 25fb476

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/Adapters/Storage/Postgres/PostgresClient.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,10 @@ export function createClient(uri, databaseOptions) {
2020

2121
if (process.env.PARSE_SERVER_LOG_LEVEL === 'debug') {
2222
const monitor = require('pg-monitor');
23-
try {
24-
monitor.attach(initOptions);
25-
} catch (e) {
23+
if(monitor.isAttached()) {
2624
monitor.detach();
27-
monitor.attach(initOptions);
2825
}
26+
monitor.attach(initOptions);
2927
}
3028

3129
if (dbOptions.pgOptions) {

0 commit comments

Comments
 (0)