log cache time

master
Kit Kasune 3 years ago
parent d2d02555bb
commit d34daabc4e
  1. 1
      bot.js
  2. 4
      util/cache/anime.js
  3. 4
      util/cache/ar.js
  4. 8
      util/cache/bl.js
  5. 4
      util/cache/char.js
  6. 4
      util/cache/chest.js
  7. 4
      util/cache/lr.js
  8. 4
      util/cache/lxp.js
  9. 4
      util/cache/monit.js

@ -150,7 +150,6 @@ async function init() {
}
for (let i = 0; i < iters.length; i++) {let x = iters[i]; await require(`./handle/${x}`)(client);}
if (client.misc.config.spinners) {
await require('./util/wait')(1000);
client.misc.cache.spinLog.forEach(log => console.log(log));
}
if (!client.misc.config.nocli) {require('./handle/console')(client);}

@ -5,6 +5,8 @@ const AniData = require('../../models/anime');
module.exports = async (client, spinner) => {
return new Promise(async resolve => {
const st = new Date().getTime();
client.misc.cache.anime = new Discord.Collection();
client.misc.cache.animeID = new Discord.Collection();
client.misc.cache.animeLove = new Discord.Collection();
@ -24,6 +26,8 @@ module.exports = async (client, spinner) => {
}
}
const cacheTime = new Date().getTime() - st;
spinner.update({text: `${spinner.options.text.slice(0, 19).trim()} ${chalk.gray(`${cacheTime}ms >>`.padStart(8, '0').padStart(7, '0'))} ${spinner.options.text.slice(19).trim()}`});
spinner.status('non-spinnable');
resolve(0);

4
util/cache/ar.js vendored

@ -3,6 +3,8 @@ const chalk = require('chalk');
module.exports = async (client, spinner) => {
return new Promise(async resolve => {
const st = new Date().getTime();
client.misc.cache.ar = new Map();
client.misc.cache.arIgnore = new Map();
let amount = 0;
@ -14,6 +16,8 @@ module.exports = async (client, spinner) => {
amount++;
}
const cacheTime = new Date().getTime() - st;
spinner.update({text: `${spinner.options.text.slice(0, 19).trim()} ${chalk.gray(`${cacheTime}ms >>`.padStart(8, '0').padStart(7, '0'))} ${spinner.options.text.slice(19).trim()}`});
spinner.status('non-spinnable');
resolve(0);
});

8
util/cache/bl.js vendored

@ -4,6 +4,8 @@ const chalk = require('chalk');
module.exports = async (client, spinner, spinner2) => {
return new Promise(async resolve => {
const st = new Date().getTime();
client.misc.cache.bl = {
guild: [],
user: []
@ -17,14 +19,20 @@ module.exports = async (client, spinner, spinner2) => {
}
spinner.update({text: `${chalk.gray('[PROC]')} >> ${chalk.blueBright(`Cached`)} ${chalk.white(`${amount}`)} ${chalk.blueBright(`guild blacklists.`)}`});
const cacheTime = new Date().getTime() - st;
spinner.update({text: `${spinner.options.text.slice(0, 19).trim()} ${chalk.gray(`${cacheTime}ms >>`.padStart(8, '0').padStart(7, '0'))} ${spinner.options.text.slice(19).trim()}`});
spinner.status('non-spinnable');
const st2 = new Date().getTime();
for await (const user of UserData.find()) {
if (user.blackisted) {client.misc.cache.bl.user.push(user.uid); amount2++;}
spinner2.update({text: `${chalk.gray('[PROC]')} >> ${chalk.blueBright(`Cached`)} ${chalk.white(`${amount2}`)} ${chalk.blueBright(`user blacklists.`)}`});
}
spinner2.update({text: `${chalk.gray('[PROC]')} >> ${chalk.blueBright(`Cached`)} ${chalk.white(`${amount2}`)} ${chalk.blueBright(`user blacklists.`)}`});
const cacheTime2 = new Date().getTime() - st2;
spinner2.update({text: `${spinner2.options.text.slice(0, 19).trim()} ${chalk.gray(`${cacheTime2}ms >>`.padStart(8, '0').padStart(7, '0'))} ${spinner2.options.text.slice(19).trim()}`});
spinner2.status('non-spinnable');
resolve(0);

@ -5,6 +5,8 @@ const CharData = require('../../models/char');
module.exports = async (client, spinner) => {
return new Promise(async resolve => {
const st = new Date().getTime();
client.misc.cache.chars = new Discord.Collection();
client.misc.cache.charsID = new Discord.Collection();
client.misc.cache.charsLove = new Discord.Collection();
@ -23,6 +25,8 @@ module.exports = async (client, spinner) => {
}
}
const cacheTime = new Date().getTime() - st;
spinner.update({text: `${spinner.options.text.slice(0, 19).trim()} ${chalk.gray(`${cacheTime}ms >>`.padStart(8, '0').padStart(7, '0'))} ${spinner.options.text.slice(19).trim()}`});
spinner.status('non-spinnable');
resolve(0);

@ -3,6 +3,8 @@ const chalk = require('chalk');
module.exports = async (client, spinner) => {
return new Promise(async resolve => {
const st = new Date().getTime();
client.misc.cache.chests.enabled = [];
let amount = 0;
@ -12,6 +14,8 @@ module.exports = async (client, spinner) => {
amount++;
}
const cacheTime = new Date().getTime() - st;
spinner.update({text: `${spinner.options.text.slice(0, 19).trim()} ${chalk.gray(`${cacheTime}ms >>`.padStart(8, '0').padStart(7, '0'))} ${spinner.options.text.slice(19).trim()}`});
spinner.status('non-spinnable');
resolve(0);
});

4
util/cache/lr.js vendored

@ -3,6 +3,8 @@ const chalk = require('chalk');
module.exports = async (client, spinner) => {
return new Promise(async resolve => {
const st = new Date().getTime();
client.misc.cache.lxp.hasLevelRoles = [];
let amount = 0;
@ -12,6 +14,8 @@ module.exports = async (client, spinner) => {
amount++;
}
const cacheTime = new Date().getTime() - st;
spinner.update({text: `${spinner.options.text.slice(0, 19).trim()} ${chalk.gray(`${cacheTime}ms >>`.padStart(8, '0').padStart(7, '0'))} ${spinner.options.text.slice(19).trim()}`});
spinner.status('non-spinnable');
resolve(0);

4
util/cache/lxp.js vendored

@ -3,6 +3,8 @@ const chalk = require('chalk');
module.exports = async (client, spinner) => {
return new Promise(async resolve => {
const st = new Date().getTime();
client.misc.cache.lxp.enabled = [];
client.misc.cache.lxp.disabledChannels = new Map();
client.misc.cache.chests.enabled = new Map();
@ -15,6 +17,8 @@ module.exports = async (client, spinner) => {
amount++;
}
const cacheTime = new Date().getTime() - st;
spinner.update({text: `${spinner.options.text.slice(0, 19).trim()} ${chalk.gray(`${cacheTime}ms >>`.padStart(8, '0').padStart(7, '0'))} ${spinner.options.text.slice(19).trim()}`});
spinner.status('non-spinnable');
resolve(0);
});

@ -3,6 +3,8 @@ const chalk = require('chalk');
module.exports = async (client, spinner) => {
return new Promise(async resolve => {
const st = new Date().getTime();
client.misc.cache.monit = {};
client.misc.cache.monitEnabled = [];
let amount = 0;
@ -18,6 +20,8 @@ module.exports = async (client, spinner) => {
amount++;
}
const cacheTime = new Date().getTime() - st;
spinner.update({text: `${spinner.options.text.slice(0, 19).trim()} ${chalk.gray(`${cacheTime}ms >>`.padStart(8, '0').padStart(7, '0'))} ${spinner.options.text.slice(19).trim()}`});
spinner.status('non-spinnable');
resolve(0);

Loading…
Cancel
Save