Compare commits
No commits in common. "140a38c34927f96a7347acabc9e95a695b55ba34" and "2dcdbf9c376d0d1118a3510569c1195bdc1de354" have entirely different histories.
140a38c349
...
2dcdbf9c37
|
|
@ -318,7 +318,6 @@ module.exports = {
|
||||||
missingDateLimit: 3,
|
missingDateLimit: 3,
|
||||||
memorySampling: {
|
memorySampling: {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
sampleDuration: 300000, // 5 minutes
|
|
||||||
snapshotIntervals: [],
|
snapshotIntervals: [],
|
||||||
},
|
},
|
||||||
media: {
|
media: {
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "traxxx",
|
"name": "traxxx",
|
||||||
"version": "1.204.4",
|
"version": "1.204.3",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "traxxx",
|
"name": "traxxx",
|
||||||
"version": "1.204.4",
|
"version": "1.204.3",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@casl/ability": "^5.2.2",
|
"@casl/ability": "^5.2.2",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "traxxx",
|
"name": "traxxx",
|
||||||
"version": "1.204.4",
|
"version": "1.204.3",
|
||||||
"description": "All the latest porn releases in one place",
|
"description": "All the latest porn releases in one place",
|
||||||
"main": "src/app.js",
|
"main": "src/app.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
||||||
27
src/app.js
27
src/app.js
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
const config = require('config');
|
const config = require('config');
|
||||||
const util = require('util');
|
const util = require('util');
|
||||||
// const log = require('why-is-node-running');
|
const log = require('why-is-node-running');
|
||||||
const Inspector = require('inspector-api');
|
const Inspector = require('inspector-api');
|
||||||
const fs = require('fs').promises;
|
const fs = require('fs').promises;
|
||||||
const dayjs = require('dayjs');
|
const dayjs = require('dayjs');
|
||||||
|
|
@ -25,7 +25,6 @@ const getFileEntries = require('./utils/file-entries');
|
||||||
const inspector = new Inspector();
|
const inspector = new Inspector();
|
||||||
let done = false;
|
let done = false;
|
||||||
|
|
||||||
/*
|
|
||||||
function logActive() {
|
function logActive() {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
log();
|
log();
|
||||||
|
|
@ -35,11 +34,10 @@ function logActive() {
|
||||||
}
|
}
|
||||||
}, typeof argv.logActive === 'number' ? argv.logActive : 60000);
|
}, typeof argv.logActive === 'number' ? argv.logActive : 60000);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
async function snapshotMemory(trigger) {
|
async function snapshotMemory() {
|
||||||
const profile = await inspector.heap.takeSnapshot();
|
const profile = await inspector.heap.takeSnapshot();
|
||||||
const filepath = `traxxx_snapshot_${trigger}M_${dayjs().format('YYYY-MM-DD_HH-mm-ss')}.heapsnapshot`;
|
const filepath = `traxxx_snapshot_${dayjs().format('YYYY-MM-DD_HH-mm-ss')}.heapprofile`;
|
||||||
|
|
||||||
logger.info(`Starting heap snapshot, memory usage: ${process.memoryUsage.rss() / 1000000} MB`);
|
logger.info(`Starting heap snapshot, memory usage: ${process.memoryUsage.rss() / 1000000} MB`);
|
||||||
|
|
||||||
|
|
@ -50,10 +48,9 @@ async function snapshotMemory(trigger) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function stopMemorySample(snapshotTriggers) {
|
async function stopMemorySample(snapshotTriggers) {
|
||||||
const usage = process.memoryUsage.rss() / 1000000;
|
|
||||||
|
|
||||||
const profile = await inspector.heap.stopSampling();
|
const profile = await inspector.heap.stopSampling();
|
||||||
const filepath = `traxxx_sample_${dayjs().format('YYYY-MM-DD_HH-mm-ss')}.heapprofile`;
|
const filepath = `traxxx_sample_${dayjs().format('YYYY-MM-DD_HH-mm-ss')}.heapprofile`;
|
||||||
|
const usage = process.memoryUsage.rss() / 1000000;
|
||||||
|
|
||||||
await inspector.heap.disable();
|
await inspector.heap.disable();
|
||||||
await fs.writeFile(filepath, JSON.stringify(profile));
|
await fs.writeFile(filepath, JSON.stringify(profile));
|
||||||
|
|
@ -61,7 +58,7 @@ async function stopMemorySample(snapshotTriggers) {
|
||||||
logger.info(`Saved heap sample to ${filepath}`);
|
logger.info(`Saved heap sample to ${filepath}`);
|
||||||
|
|
||||||
if (usage > snapshotTriggers[0]) {
|
if (usage > snapshotTriggers[0]) {
|
||||||
await snapshotMemory(snapshotTriggers[0]);
|
await snapshotMemory();
|
||||||
return snapshotTriggers.slice(1);
|
return snapshotTriggers.slice(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -82,22 +79,22 @@ async function startMemorySample(snapshotTriggers = []) {
|
||||||
if (!done) {
|
if (!done) {
|
||||||
await startMemorySample(newSnapshotTriggers);
|
await startMemorySample(newSnapshotTriggers);
|
||||||
}
|
}
|
||||||
}, config.memorySampling.sampleDuration);
|
}, 30000);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function init() {
|
async function init() {
|
||||||
try {
|
try {
|
||||||
if (argv.server) {
|
|
||||||
await initServer();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (argv.sampleMemory) {
|
if (argv.sampleMemory) {
|
||||||
await startMemorySample(config.memorySampling.snapshotIntervals);
|
await startMemorySample(config.memorySampling.snapshotIntervals);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argv.logActive) {
|
if (argv.logActive) {
|
||||||
// logActive();
|
logActive();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (argv.server) {
|
||||||
|
await initServer();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argv.updateSearch) {
|
if (argv.updateSearch) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue