mirror of
https://github.com/smogon/pokemon-showdown-loginserver.git
synced 2026-09-09 02:35:11 -05:00
Don't set a file watcher on every request
This commit is contained in:
@@ -68,12 +68,6 @@ export class Dispatcher {
|
||||
this.user = new User(this.session);
|
||||
this.opts = opts;
|
||||
this.cookies = Dispatcher.parseCookie(this.request.headers.cookie);
|
||||
|
||||
fs.watchFile(Config.serverlist, (curr, prev) => {
|
||||
if (curr.mtime > prev.mtime) {
|
||||
Dispatcher.loadServers();
|
||||
}
|
||||
});
|
||||
}
|
||||
async executeActions() {
|
||||
const {act, body} = this.opts;
|
||||
@@ -261,4 +255,12 @@ export class Dispatcher {
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
static {
|
||||
fs.watchFile(Config.serverlist, (curr, prev) => {
|
||||
if (curr.mtime > prev.mtime) {
|
||||
Dispatcher.loadServers();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user