1
0
Fork 0

change interval timing on storage

refactor/models
Matthew 2019-11-09 23:13:49 -05:00
parent 615cc76904
commit cbeb964b21
No known key found for this signature in database
GPG Key ID: 766BE43AE75F7559
1 changed files with 4 additions and 1 deletions

View File

@ -3,7 +3,7 @@ import fs from 'fs-extra';
import { Client } from '..'; import { Client } from '..';
export default function storage(client: Client) { export default function storage(client: Client) {
setInterval(async () => { const main = async () => {
const accounts = await client.db.Account.find(); const accounts = await client.db.Account.find();
for (const account of accounts) { for (const account of accounts) {
let bytes = Number(await client.util.exec(`du -bs /home/${account.username}`)); let bytes = Number(await client.util.exec(`du -bs /home/${account.username}`));
@ -15,5 +15,8 @@ export default function storage(client: Client) {
} }
await client.redis.set(`storage-${account.username}`, bytes); await client.redis.set(`storage-${account.username}`, bytes);
} }
};
setInterval(async () => {
await main();
}, 300000); }, 300000);
} }