diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-09-05 13:45:44 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-09-05 13:45:44 -0400 |
commit | 81d69f983983ac71dbdbd5f13e2f2d8ddc35dced (patch) | |
tree | 6a06124a6696bb4036607d179972aa889b7b3769 /src/tasks | |
parent | 93e8fce44ec1dd3294b1c785d93d3f8b00ee4cef (diff) | |
download | tanzanite-81d69f983983ac71dbdbd5f13e2f2d8ddc35dced.tar.gz tanzanite-81d69f983983ac71dbdbd5f13e2f2d8ddc35dced.tar.bz2 tanzanite-81d69f983983ac71dbdbd5f13e2f2d8ddc35dced.zip |
cleaning up and some imporvements to the stats command
Diffstat (limited to 'src/tasks')
-rw-r--r-- | src/tasks/cpuUsage.ts | 15 | ||||
-rw-r--r-- | src/tasks/updateCache.ts | 2 |
2 files changed, 16 insertions, 1 deletions
diff --git a/src/tasks/cpuUsage.ts b/src/tasks/cpuUsage.ts new file mode 100644 index 0000000..a7398d7 --- /dev/null +++ b/src/tasks/cpuUsage.ts @@ -0,0 +1,15 @@ +import { BushTask } from '@lib'; +import * as osu from 'node-os-utils'; + +export default class CpuUsageTask extends BushTask { + public constructor() { + super('cpuUsage', { + delay: 60_000, // 1 minute + runOnStart: true + }); + } + public override async exec(): Promise<void> { + const cpu = await osu.cpu.usage(client.stats.cpu === undefined ? 100 : 60_000); + client.stats.cpu = cpu; + } +} diff --git a/src/tasks/updateCache.ts b/src/tasks/updateCache.ts index 69919d8..e9d0cc6 100644 --- a/src/tasks/updateCache.ts +++ b/src/tasks/updateCache.ts @@ -4,7 +4,7 @@ import { Global } from '../lib/models/Global'; import { Guild } from '../lib/models/Guild'; import config from './../config/options'; -export class UpdateCacheTask extends BushTask { +export default class UpdateCacheTask extends BushTask { public constructor() { super('updateCache', { delay: 300_000, // 5 minutes |