mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-08 20:47:02 +03:00
Fix fail calculation
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user