remote-renderer-ready-evidence.ts 601 B

123456789101112
  1. /** 只认 Main 校验 attachment 后写出的 reload ready ACK,忽略连接事件、迟到拒绝和半行日志。 */
  2. export function countRendererReloadAcks(content: string): Map<string, number> {
  3. const counts = new Map<string, number>();
  4. for (const line of content.split("\n").slice(0, -1)) {
  5. const match =
  6. /^\[[^\]]+\] \[info\] \[pid:\d+\] \[main\] \[window-host-remote\] renderer attachment ready, sessionId=([^,\s]+), reason=[^,\s]+:renderer-reload\r?$/u.exec(
  7. line,
  8. );
  9. if (match) counts.set(match[1]!, (counts.get(match[1]!) ?? 0) + 1);
  10. }
  11. return counts;
  12. }