Skip to content

Commit 262885a

Browse files
fix(Wind): Reduce IPC logging to prevent channel saturation during extension boot
The Tauri IPC channel was being saturated during extension boot by excessive _DevLogForward calls: - Successful "tauri-invoke" completions logged every invoke (redundant - Mountain's Rust side already logs ok/fail with ns precision via `[DEV:IPC] done:`) - All fire-and-forget channel stubs logged (noop/value cases are routine) This caused keystroke lag as user input queued behind the log noise on the shared WebKit message channel. Fix removes: - Success-case tauri-invoke forward (failures still forwarded - stack traces are worth the cost) - Fire-and-forget channel stub logging entirely - Only forward `drift` disposition case (the noteworthy scenario) Catalog version bumped to 2026-05-01 reflecting codegen run.
1 parent 31a0dd9 commit 262885a

3 files changed

Lines changed: 31 additions & 26 deletions

File tree

Source/Effect/Generated/CommandCatalog.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export interface CommandCatalogEntry {
2323
readonly HasKeybinding: boolean;
2424
}
2525

26-
export const CommandCatalogVersion = "2026-04-30" as const;
26+
export const CommandCatalogVersion = "2026-05-01" as const;
2727

2828
export const CommandCatalogTotal = 542 as const;
2929

Source/Effect/Generated/ServiceCatalog.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export interface ServiceCatalogEntry {
1919
readonly MemberCount: number;
2020
}
2121

22-
export const ServiceCatalogVersion = "2026-04-30" as const;
22+
export const ServiceCatalogVersion = "2026-05-01" as const;
2323

2424
export const ServiceCatalogTotal = 475 as const;
2525

Source/Service/TauriMainProcessService.ts

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -488,28 +488,29 @@ async function InvokeMountain(
488488

489489
if (typeof Invoke !== "function") return undefined;
490490

491-
// `tauri-invoke` tag: per-invoke duration + ok/fail. Mirror of the
492-
// Output copy - the Rust `ipc` tag already logs paired invoke/done
493-
// lines with ns precision; this line captures the *render-side*
494-
// elapsed time including Tauri transport, so a slow transport
495-
// (webview message channel starvation) vs a slow handler (Echo
496-
// backlog / lock contention) can be told apart.
491+
// `tauri-invoke` tag: previously fired `_DevLogForward` after EVERY
492+
// successful (and failed) `MountainIPCInvoke`. Even though
493+
// Mountain's `dev_log!` macro silently drops disabled tags, the
494+
// IPC ROUND TRIP that delivers the log line ALREADY HAPPENED -
495+
// Tauri's invoke channel serialises the call and queues it behind
496+
// any in-flight invokes. During extension boot this *doubled* IPC
497+
// traffic and saturated the channel, queueing keystrokes (which
498+
// share the same WebKit message channel as IPC replies on macOS)
499+
// behind the log noise. Symptom: the user typed in the editor,
500+
// nothing visible happened, then later switched focus and the
501+
// queued keystrokes flushed into the new focused element. Mirror
502+
// of the Output-side fix - drop the success-case forward; the
503+
// Rust-side `[DEV:IPC] done: <method> ok=true t_ns=…` line
504+
// already carries the same data at ns precision and is
505+
// filterable via `Trace=ipc`. Failures still forward (rare,
506+
// stack-trace context worth the cost).
497507
const Start =
498508
typeof performance !== "undefined" ? performance.now() : Date.now();
499509
try {
500-
const Value = await Invoke("MountainIPCInvoke", {
510+
return await Invoke("MountainIPCInvoke", {
501511
method: Method,
502512
params: Params,
503513
});
504-
const Elapsed =
505-
(typeof performance !== "undefined"
506-
? performance.now()
507-
: Date.now()) - Start;
508-
_DevLogForward(
509-
"tauri-invoke",
510-
`[TauriInvoke] method=${Method} ok=true elapsed_ms=${Elapsed.toFixed(2)}`,
511-
);
512-
return Value;
513514
} catch (Error) {
514515
const Elapsed =
515516
(typeof performance !== "undefined"
@@ -547,10 +548,10 @@ class TauriChannel implements IChannel {
547548
Arg !== undefined ? (Array.isArray(Arg) ? Arg : [Arg]) : [],
548549
).catch(() => {});
549550
}
550-
_DevLogForward(
551-
"channel-stub",
552-
`fire-and-forget channel=${this.ChannelName} cmd=${Command} route=${this.RoutePrefix ?? "<none>"}`,
553-
);
551+
// `_DevLogForward("channel-stub", "fire-and-forget …")`
552+
// dropped here for the same IPC-saturation reason as the
553+
// success-case `tauri-invoke` forward above. Mirror of the
554+
// Output-side fix.
554555
return undefined as T;
555556
}
556557

@@ -569,10 +570,14 @@ class TauriChannel implements IChannel {
569570
? "noop"
570571
: "value"
571572
: "drift";
572-
_DevLogForward(
573-
"channel-stub",
574-
`stub-hit channel=${this.ChannelName} cmd=${Command} disposition=${Disposition}`,
575-
);
573+
// Only forward for `drift` - the noteworthy case. `value` /
574+
// `noop` are routine and would saturate the IPC channel.
575+
if (Disposition === "drift") {
576+
_DevLogForward(
577+
"channel-stub",
578+
`stub-hit channel=${this.ChannelName} cmd=${Command} disposition=${Disposition}`,
579+
);
580+
}
576581
return (StubValue !== undefined ? StubValue : undefined) as T;
577582
}
578583

0 commit comments

Comments
 (0)