From 2955aec793345eff668151a2017fd14f0382e353 Mon Sep 17 00:00:00 2001 From: Matthew R Date: Mon, 23 Mar 2020 22:26:29 -0400 Subject: [PATCH] storage interval code cleanup --- src/intervals/storage.ts | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/src/intervals/storage.ts b/src/intervals/storage.ts index ec81b7d..488a578 100644 --- a/src/intervals/storage.ts +++ b/src/intervals/storage.ts @@ -4,27 +4,6 @@ import { spawn } from 'child_process'; import { Client } from '..'; export default async function storage(client: Client) { - /* const main = async () => { - const accounts = await client.db.Account.find(); - for (const account of accounts) { - setTimeout(async () => { - const res = await client.util.exec(`du -bs /home/${account.username}`); - let bytes = Number(res.split('/')[0].replace('\t', '')); - try { - await fs.access(`/opt/mail/${account.username}`, fs.constants.F_OK); - const res2 = await client.util.exec(`du -bs /opt/mail/${account.username}`); - bytes += Number(res2.split('/')[0].replace('\t', '')); - } catch { - bytes += 0; - } - await client.redis.set(`storage-${account.username}`, bytes); - }, 600000); - } - }; - await main(); - setInterval(async () => { - await main(); - }, 900000); */ let storageGo = spawn(`${__dirname}/../bin/storage`, [], { cwd: __dirname }); storageGo.stdout.on('data', (data) => client.signale.log(data.toString())); storageGo.stderr.on('data', (data) => client.signale.log(data.toString()));