feat: add db query timeout option
This commit is contained in:
parent
4b8dc1fa1c
commit
ab5dcd3640
6 changed files with 105 additions and 67 deletions
|
|
@ -7,7 +7,7 @@ import * as morgan from "morgan";
|
|||
import { Pool, createPool } from "mysql2/promise";
|
||||
import { engine as handlebarsEngine } from "express-handlebars";
|
||||
|
||||
import { Config } from "./Config";
|
||||
import { Config, IRealmConfig } from "./Config";
|
||||
import { DbcManager } from "./data/DbcReader";
|
||||
import { CharacterCustomization } from "./data/CharacterCustomization";
|
||||
import { IndexController } from "./controllers/IndexController";
|
||||
|
|
@ -148,14 +148,12 @@ export class Armory {
|
|||
|
||||
// Respond with html page
|
||||
if (req.accepts("html")) {
|
||||
res.render("error.html", this.getErrorViewData(404, req));
|
||||
return;
|
||||
return res.render("error.html", this.getErrorViewData(404, req));
|
||||
}
|
||||
|
||||
// Respond with json
|
||||
if (req.accepts("json")) {
|
||||
res.json({ error: this.errorNames[404] });
|
||||
return;
|
||||
return res.json({ error: this.errorNames[404] });
|
||||
}
|
||||
|
||||
// Default to plain-text
|
||||
|
|
@ -172,6 +170,10 @@ export class Armory {
|
|||
return this.charsDbs[realm.toLowerCase()];
|
||||
}
|
||||
|
||||
public getRealm(realm: string): IRealmConfig {
|
||||
return this.config.realms.find(r => r.name.toLowerCase() === realm.toLowerCase());
|
||||
}
|
||||
|
||||
public gc(): void {
|
||||
if (this.config.loadDbcs) {
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue