Skip to content

Commit 75e2289

Browse files
authored
fix: fix lost CDP messages by increasing MAX_MESSAGE_POOL_SIZE to cache more messages (#103)
1 parent 31b1632 commit 75e2289

File tree

1 file changed

+3
-2
lines changed
  • plugins/devtool/renderer/devtool/services

1 file changed

+3
-2
lines changed

plugins/devtool/renderer/devtool/services/batcher.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
import { ICDPMessageDispatcher } from '../types';
1111
import { IDebugDriver } from '@lynx-js/devtool-plugin-core/renderer';
1212

13-
const MAX_MESSAGE_POOL_SIZE = 100;
13+
const MAX_MESSAGE_POOL_SIZE = 1000;
1414

1515
class CDPMessageDispatcher implements ICDPMessageDispatcher {
1616
private _callbackMap: Map<string, (message: ICustomDataWrapper<ECustomDataType.CDP>) => void> = new Map();
@@ -58,7 +58,8 @@ class CDPMessageDispatcher implements ICDPMessageDispatcher {
5858
clientPool[sessionId] = [];
5959
}
6060
if (clientPool[sessionId].length >= MAX_MESSAGE_POOL_SIZE) {
61-
clientPool[sessionId].shift();
61+
const droppedMessage = clientPool[sessionId].shift();
62+
console.warn('CDP message pool is full, dropping message: ', droppedMessage);
6263
}
6364
clientPool[sessionId].push(message);
6465
}

0 commit comments

Comments
 (0)