Logging memory usage on media fetch.

This commit is contained in:
DebaucheryLibrarian
2021-12-27 17:29:23 +01:00
parent 0ad64ef5f4
commit 299f257a01
5 changed files with 16 additions and 22 deletions

View File

@@ -38,12 +38,12 @@ async function snapshotMemory() {
const profile = await inspector.heap.takeSnapshot();
const filepath = `traxxx_snapshot_${dayjs().format('YYYY-MM-DD_HH-mm-ss')}.heapprofile`;
logger.info(`Start heap snapshots, memory usage: ${process.memoryUsage.rss() / 1000000} MB`);
logger.info(`Starting heap snapshot, memory usage: ${process.memoryUsage.rss() / 1000000} MB`);
await inspector.heap.disable();
await fs.writeFile(filepath, JSON.stringify(profile));
logger.info(`Saved heap dump to ${filepath}`);
logger.info(`Saved heap snapshot to ${filepath}`);
}
async function stopMemorySample(snapshotTriggers) {