Merge pull request #536 from getmaxun/circular

fix: browser pool circular dependency
This commit is contained in:
Karishma Shukla
2025-04-22 00:56:09 +05:30
committed by GitHub
3 changed files with 9 additions and 8 deletions

View File

@@ -118,11 +118,11 @@ export class RemoteBrowser {
* @param socket socket.io socket instance used to communicate with the client side
* @constructor
*/
public constructor(socket: Socket, userId: string) {
public constructor(socket: Socket, userId: string, poolId: string) {
this.socket = socket;
this.userId = userId;
this.interpreter = new WorkflowInterpreter(socket);
this.generator = new WorkflowGenerator(socket);
this.generator = new WorkflowGenerator(socket, poolId);
}
private initializeMemoryManagement(): void {

View File

@@ -32,7 +32,7 @@ export const initializeRemoteBrowserForRecording = (userId: string): string => {
remoteBrowser?.updateSocket(socket);
await remoteBrowser?.makeAndEmitScreenshot();
} else {
const browserSession = new RemoteBrowser(socket, userId);
const browserSession = new RemoteBrowser(socket, userId, id);
browserSession.interpreter.subscribeToPausing();
await browserSession.initialize(userId);
await browserSession.registerEditorEvents();
@@ -62,7 +62,7 @@ export const createRemoteBrowserForRun = (userId: string): string => {
io.of(`/${id}`),
async (socket: Socket) => {
try {
const browserSession = new RemoteBrowser(socket, userId);
const browserSession = new RemoteBrowser(socket, userId, id);
await browserSession.initialize(userId);
browserPool.addRemoteBrowser(id, browserSession, userId, false, "run");
socket.emit('ready-for-run');