mirror of
https://github.com/System-End/slack-end.git
synced 2026-04-19 16:28:19 +00:00
fix: debug + mem stats
This commit is contained in:
parent
9e14394482
commit
8f35aa792c
4 changed files with 22 additions and 1 deletions
|
|
@ -30,6 +30,9 @@
|
|||
"stegcloak": "^1.1.1",
|
||||
"ws": "^8.18.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"memwatch-next": "latest"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^22.7.4",
|
||||
"canvas": "^2.11.2",
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import { watchForWhenIUseHacktime } from "./modules/hacktime";
|
|||
|
||||
import { EncryptedJsonDb } from "./modules/encrypted-db";
|
||||
import { setupOverallCron } from "./modules/cron";
|
||||
import watchMem from "./modules/memwatch";
|
||||
|
||||
const db = new JSONdb("data/data.json");
|
||||
app.dbs = {};
|
||||
|
|
@ -34,6 +35,7 @@ app.dbs.anondm = new EncryptedJsonDb("data/anondm.json", {
|
|||
app.dbs.tags = new JSONdb("data/tags.json");
|
||||
app.dbs.stickymessages = new JSONdb("data/stickymessages.json");
|
||||
attachDB(db);
|
||||
watchMem(app)
|
||||
app.start(process.env.PORT || 3000).then(async (d) => {
|
||||
console.log(`App is UP (please help)`);
|
||||
watchForWhenIUseHacktime(app);
|
||||
|
|
|
|||
16
src/modules/memwatch.ts
Normal file
16
src/modules/memwatch.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import memwatch from "memwatch-next"
|
||||
import { ModifiedApp } from "./slackapp";
|
||||
export default function watchMem(app:ModifiedApp) {
|
||||
memwatch.on('leak', (info) => {
|
||||
app.client.chat.postMessage({
|
||||
text: `:x: my memory is leaking plz kill me :3\n\`\`\`\n${JSON.stringify(info, null, 2)}\n\`\`\``,
|
||||
channel: `C07LGLUTNH2`
|
||||
})
|
||||
});
|
||||
memwatch.on('stats', function(stats) {
|
||||
app.client.chat.postMessage({
|
||||
text: `debug: mem stats ;3 \n\`\`\`\n${JSON.stringify(stats, null, 2)}\n\`\`\``,
|
||||
channel: `C07LGLUTNH2`
|
||||
})
|
||||
});
|
||||
}
|
||||
|
|
@ -248,7 +248,7 @@ export function setupCronForShipments(app: ModifiedApp) {
|
|||
);
|
||||
} catch (e) {
|
||||
// coulda failed parsing or diff..
|
||||
console.error(e, `shipment viewer`);
|
||||
console.error(e, `shipment viewer`, userURLID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue