Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions server/throttle.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { logger } from '../utility/logging/logger.ts';
import { Session, url as inspectorURL } from 'inspector';
Comment thread
kriszyp marked this conversation as resolved.
Outdated
const MAX_EVENT_DELAY_TIME = 3000;
const DEFAULT_MAX_QUEUE_TIME = 20_000; // 20 seconds
let lastWarning = 0;
Expand Down Expand Up @@ -71,3 +72,20 @@ setInterval(() => {
}
lastEventQueueCheck = now;
}, EVENT_QUEUE_MONITORING_INTERVAL).unref();

// Reset lastEventQueueCheck if we are resuming from the debugger
// so the event loop lag check ignores breakpoint pauses
setTimeout(() => {
// wait for any debugger to register and then see if the inspector/debugger is actually enabled
if (inspectorURL()) {
const session = new Session();
session.connect();
session.post('Debugger.enable');
session.on('inspectorNotification', ({ method }) => {
if (method === 'Debugger.resumed') {
// reset if we are resuming
lastEventQueueCheck = performance.now();
}
});
}
}, 1);
Loading