mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2024-11-10 17:17:50 +01:00
Prevent errors from double calling release
This commit is contained in:
parent
de60415f55
commit
b1b40d410f
1 changed files with 15 additions and 3 deletions
|
@ -40,7 +40,11 @@ export class Postgres implements IDatabase {
|
|||
Logger.error(err.stack);
|
||||
this.lastPoolFail = Date.now();
|
||||
|
||||
try {
|
||||
client.release(true);
|
||||
} catch (err) {
|
||||
Logger.error(`prepare (postgres): ${err}`);
|
||||
}
|
||||
});
|
||||
|
||||
if (this.config.postgresReadOnly) {
|
||||
|
@ -49,7 +53,11 @@ export class Postgres implements IDatabase {
|
|||
Logger.error(err.stack);
|
||||
this.lastPoolReadFail = Date.now();
|
||||
|
||||
try {
|
||||
client.release(true);
|
||||
} catch (err) {
|
||||
Logger.error(`prepare (postgres): ${err}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -109,7 +117,11 @@ export class Postgres implements IDatabase {
|
|||
} catch (err) {
|
||||
Logger.error(`prepare (postgres): ${err}`);
|
||||
} finally {
|
||||
try {
|
||||
client?.release();
|
||||
} catch (err) {
|
||||
Logger.error(`prepare (postgres): ${err}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue