Skip to content

Commit

Permalink
Fix used memory using the wrong value (pre7)
Browse files Browse the repository at this point in the history
  • Loading branch information
DEVTomatoCake committed Dec 18, 2023
1 parent 9441f51 commit 2dfbaa7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
8 changes: 5 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ class DisStat extends EventEmitter {
data.users = this.bot.guilds.cache.filter(guild => guild.available).reduce((acc, cur) => acc + cur.memberCount, 0)
data.apiPing = this.bot.ws.ping > 0 ? this.bot.ws.ping : void 0
}
data.ramUsage = process.memoryUsage.rss()
data.ramTotal = process.memoryUsage().heapTotal

const memory = process.memoryUsage()
data.ramUsage = memory.heapUsed
data.ramTotal = memory.heapTotal

const endUsage = process.cpuUsage()
const elapTime = endUsage.user - this.startUsage.user + endUsage.system - this.startUsage.system
Expand All @@ -61,7 +63,7 @@ class DisStat extends EventEmitter {
try {
result = await this.postData(data)
} catch (e) {
this.emit("autopostError", e, data)
this.emit("autopostError", result, data)
console.warn("[DisStat " + new Date().toLocaleTimeString() + "] Failed to post data to DisStat API. Error: " + e.message, result)

setTimeout(() => this.autopost(), autopostInterval)
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "disstat",
"version": "1.0.0-pre6",
"version": "1.0.0-pre7",
"description": "Post data from a discord.js client automatically, or manually to DisStat for Discord bot statistic tracking.",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 2dfbaa7

Please sign in to comment.