From 82ab711f4564838d51216955e73fbdd901603581 Mon Sep 17 00:00:00 2001 From: Flummi Date: Fri, 24 Nov 2017 22:35:35 +0100 Subject: [PATCH] increase recachetime --- src/inc/clients/irc.js | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/src/inc/clients/irc.js b/src/inc/clients/irc.js index 9bf8d6d..f24de5f 100644 --- a/src/inc/clients/irc.js +++ b/src/inc/clients/irc.js @@ -20,7 +20,7 @@ export class irc { this.username = this.options.username || "test"; this.realname = this.options.realname || "test"; this.channels = this.options.channels || []; - this._recachetime = 60 * 5; // 5 minutes + this._recachetime = 60 * 30; // 30 minutes this._cmd = new Map(); fs.readdirSync(`${__dirname}/irc/`).forEach(file => { @@ -99,9 +99,30 @@ export class irc { } whois(user, force = false) { user = user.toLowerCase(); - if(this.server.user.hasi(user) && !force) - if(this.server.user.geti(user).cached >= ~~(Date.now() / 1000) - this._recachetime) + let tmpuser = {}; + if(this.server.user.hasi(user) && !force) { + console.log("existiert", user); + tmpuser = this.server.user.geti(user); + if(tmpuser.cached >= ~~(Date.now() / 1000) - this._recachetime) { + console.log("already cached", user); return; + } + } + + tmpuser = { + nickname: tmpuser.nickname || false, + username: tmpuser.username || false, + hostname: tmpuser.hostname || false, + realname: tmpuser.realname || false, + account: tmpuser.account || false, + registered: tmpuser.registered || false, + oper: tmpuser.oper || false, + channels: tmpuser.channels || [], + cached: ~~(Date.now() / 1000) + }; + this.server.user.set(user, tmpuser); + + console.log("whois", user); this.send(`WHOIS ${user}`); } parsePrefix(prefix) {