Upgrade Electron to 39.2.7 to fix macOS Tahoe GPU performance regression (#931)

This commit is contained in:
Copilot
2025-12-20 03:06:22 +01:00
committed by GitHub
parent 91df6de4d4
commit 5a54ba4983
12 changed files with 52 additions and 42 deletions

View File

@@ -7,7 +7,7 @@ export class IpcMainEventBus implements EventBusInterface {
private clients: Map<number, WebContents> = new Map() // webContentsId -> WebContents
private connectionOwners: Map<string, number> = new Map() // connectionId -> webContentsId
private currentClient: WebContents | undefined
constructor(ipc: IpcMain) {
this.ipc = ipc
}
@@ -16,34 +16,34 @@ export class IpcMainEventBus implements EventBusInterface {
this.ipc.on(subscribeEvent.topic, (event: any, arg: any) => {
const sender = event.sender as WebContents
this.currentClient = sender
// Track the client (O(1) operation)
if (!this.clients.has(sender.id)) {
this.clients.set(sender.id, sender)
// Clean up when window is closed
sender.once('destroyed', () => {
this.clients.delete(sender.id)
// Clean up owned connections
for (const [connectionId, webContentsId] of this.connectionOwners.entries()) {
Array.from(this.connectionOwners.entries()).forEach(([connectionId, webContentsId]) => {
if (webContentsId === sender.id) {
this.connectionOwners.delete(connectionId)
}
}
})
})
}
// Track connection ownership
if (subscribeEvent.topic === 'connection/add/mqtt' && arg?.id) {
this.connectionOwners.set(arg.id, sender.id)
}
// Remove connection ownership
if (subscribeEvent.topic === 'connection/remove' && typeof arg === 'string') {
this.connectionOwners.delete(arg)
}
callback(arg)
})
}
@@ -58,7 +58,7 @@ export class IpcMainEventBus implements EventBusInterface {
public emit<MessageType>(event: Event<MessageType>, msg: MessageType) {
const topic = event.topic
// RPC responses go only to the requesting client
if (topic.includes('/response/')) {
if (this.currentClient && !this.currentClient.isDestroyed()) {
@@ -66,18 +66,18 @@ export class IpcMainEventBus implements EventBusInterface {
}
return
}
// Connection-specific events - optimized with early pattern match
if (topic.startsWith('conn/')) {
const parts = topic.split('/')
let connectionId: string | undefined
if (parts.length === 2) {
connectionId = parts[1]
} else if (parts.length === 3 && (parts[1] === 'state' || parts[1] === 'publish')) {
connectionId = parts[2]
}
if (connectionId) {
const ownerWebContentsId = this.connectionOwners.get(connectionId)
if (ownerWebContentsId !== undefined) {
@@ -89,7 +89,7 @@ export class IpcMainEventBus implements EventBusInterface {
}
}
}
// All other events go to all clients
this.clients.forEach(client => {
if (!client.isDestroyed()) {

View File

@@ -23,7 +23,7 @@ export class SocketIOServerEventBus implements EventBusInterface {
private globalHandlers: Map<string, (socket: Socket, arg: any) => void> = new Map()
// Per-socket subscriptions for cleanup
private socketSubscriptions: Map<string, SocketSubscription[]> = new Map()
private socketSubscriptions: Map<string, Array<SocketSubscription>> = new Map()
// Track which socket is currently processing a request
private currentSocket: Socket | undefined
@@ -73,7 +73,7 @@ export class SocketIOServerEventBus implements EventBusInterface {
event,
totalClients,
totalSubscriptions,
totalConnections,
socketId.substring(0, 8),
socketSubs,