mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2024-11-10 09:07:47 +01:00
Fix fail calculation
This commit is contained in:
parent
e615d7c032
commit
86e61c778c
1 changed files with 2 additions and 2 deletions
|
@ -111,8 +111,8 @@ export class Postgres implements IDatabase {
|
|||
|
||||
private getClient(type: string): Promise<PoolClient> {
|
||||
const readAvailable = this.poolRead && (type === "get" || type === "all");
|
||||
const ignroreReadDueToFailure = this.lastPoolReadFail < Date.now() - 1000 * 30;
|
||||
const readDueToFailure = this.lastPoolFail < Date.now() - 1000 * 30;
|
||||
const ignroreReadDueToFailure = this.lastPoolReadFail > Date.now() - 1000 * 30;
|
||||
const readDueToFailure = this.lastPoolFail > Date.now() - 1000 * 30;
|
||||
if (readAvailable && !ignroreReadDueToFailure && (readDueToFailure ||
|
||||
Math.random() > 1 / (this.config.postgresReadOnly.weight + 1))) {
|
||||
return this.poolRead.connect();
|
||||
|
|
Loading…
Reference in a new issue