kernel/src/logLargeState.ts

29 lines
925 B
TypeScript

import { notableErrors } from "./err.js";
import { log } from "./log.js";
import { modules, modulesLoading, queries } from "./queries.js";
// Set up a loop that will periodically log all of the large objects in the
// kernel, for the sake of making detection and debugging easier in the event
// of a
let waitTime = 30000;
function logLargeObjects() {
const queriesLenStr = Object.keys(queries).length.toString();
const modulesLenStr = Object.keys(modules).length.toString();
const modulesLoadingLenStr = Object.keys(modulesLoading).length.toString();
log(
"open queries :: open modules :: modules loading :: notable errors : " +
queriesLenStr +
" :: " +
modulesLenStr +
" :: " +
modulesLoadingLenStr +
" :: " +
notableErrors.length,
);
waitTime *= 1.25;
setTimeout(logLargeObjects, waitTime);
}
setTimeout(logLargeObjects, waitTime);
export { logLargeObjects };