mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-10 21:47:02 +03:00
Show total stats if not under high load
This commit is contained in:
@@ -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";
|
||||
@@ -32,4 +32,8 @@ export class Mysql implements IDatabase {
|
||||
}
|
||||
}
|
||||
|
||||
highLoad() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -235,4 +235,8 @@ export class Postgres implements IDatabase {
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
highLoad() {
|
||||
return this.activePostgresRequests > this.config.postgres.highLoadThreshold;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user