Show total stats if not under high load

This commit is contained in:
Ajay
2022-11-20 00:47:41 -05:00
parent df76b5f053
commit 87e38c8bc4
7 changed files with 46 additions and 5 deletions

View File

@@ -7,6 +7,8 @@ export interface IDatabase {
init(): Promise<void>;
prepare(type: QueryType, query: string, params?: any[], options?: QueryOption): Promise<any | any[] | void>;
highLoad(): boolean;
}
export type QueryType = "get" | "all" | "run";

View File

@@ -32,4 +32,8 @@ export class Mysql implements IDatabase {
}
}
highLoad() {
return false;
}
}

View File

@@ -235,4 +235,8 @@ export class Postgres implements IDatabase {
return result;
}
highLoad() {
return this.activePostgresRequests > this.config.postgres.highLoadThreshold;
}
}

View File

@@ -95,6 +95,10 @@ export class Sqlite implements IDatabase {
private static processUpgradeQuery(query: string): string {
return query.replace(/^.*--!sqlite-ignore/gm, "");
}
highLoad() {
return false;
}
}
export interface SqliteConfig {