diff --git a/src/main/services/infrastructure/HttpServer.ts b/src/main/services/infrastructure/HttpServer.ts index f4469432..81ad929d 100644 --- a/src/main/services/infrastructure/HttpServer.ts +++ b/src/main/services/infrastructure/HttpServer.ts @@ -47,9 +47,12 @@ export class HttpServer { private app: FastifyInstance | null = null; private port: number = 3456; private running: boolean = false; + private startingPromise: Promise | null = null; /** * Start the HTTP server. + * Deduplicates concurrent calls — if start() is already in progress, + * subsequent calls await the same promise. * @param services - Service instances to pass to route handlers * @param sshModeSwitchCallback - Callback for SSH mode switching * @param preferredPort - Port to try first (default 3456) @@ -60,6 +63,24 @@ export class HttpServer { sshModeSwitchCallback: (mode: 'local' | 'ssh') => Promise, preferredPort: number = 3456, host: string = '127.0.0.1' + ): Promise { + if (this.startingPromise) { + return this.startingPromise; + } + + this.startingPromise = this.doStart(services, sshModeSwitchCallback, preferredPort, host); + try { + return await this.startingPromise; + } finally { + this.startingPromise = null; + } + } + + private async doStart( + services: HttpServices, + sshModeSwitchCallback: (mode: 'local' | 'ssh') => Promise, + preferredPort: number, + host: string ): Promise { this.app = Fastify({ logger: false }); diff --git a/src/renderer/components/team/activity/ActivityTimeline.tsx b/src/renderer/components/team/activity/ActivityTimeline.tsx index 449a8dcd..31b5510b 100644 --- a/src/renderer/components/team/activity/ActivityTimeline.tsx +++ b/src/renderer/components/team/activity/ActivityTimeline.tsx @@ -477,7 +477,7 @@ export const ActivityTimeline = React.memo(function ActivityTimeline({ if (messages.length === 0) { return ( -
+

No messages

Send a message to a member to see activity.