diff options
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 |