mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2024-11-10 09:07:47 +01:00
ctch client connection errors
This commit is contained in:
parent
5057c86707
commit
3844404637
1 changed files with 12 additions and 2 deletions
|
@ -43,7 +43,7 @@ export class Postgres implements IDatabase {
|
|||
try {
|
||||
client.release(true);
|
||||
} catch (err) {
|
||||
Logger.error(`prepare (postgres): ${err}`);
|
||||
Logger.error(`pool (postgres): ${err}`);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -56,7 +56,7 @@ export class Postgres implements IDatabase {
|
|||
try {
|
||||
client.release(true);
|
||||
} catch (err) {
|
||||
Logger.error(`prepare (postgres): ${err}`);
|
||||
Logger.error(`poolRead (postgres): ${err}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -97,6 +97,16 @@ export class Postgres implements IDatabase {
|
|||
let client: PoolClient;
|
||||
try {
|
||||
client = await this.getClient(type);
|
||||
client.on("error", (err) => {
|
||||
Logger.error(err.stack);
|
||||
|
||||
try {
|
||||
client.release(true);
|
||||
} catch (err) {
|
||||
Logger.error(`client (postgres): ${err}`);
|
||||
}
|
||||
});
|
||||
|
||||
const queryResult = await client.query({ text: query, values: params });
|
||||
|
||||
switch (type) {
|
||||
|
|
Loading…
Reference in a new issue