()
| 65 | * startup so the subprocess runs in parallel with module loading. |
| 66 | */ |
| 67 | export function startMdmSettingsLoad(): void { |
| 68 | if (mdmLoadPromise) return |
| 69 | mdmLoadPromise = (async () => { |
| 70 | profileCheckpoint('mdm_load_start') |
| 71 | const startTime = Date.now() |
| 72 | |
| 73 | // Use the startup raw read if cli.tsx fired it, otherwise fire a fresh one. |
| 74 | // Both paths produce the same RawReadResult; consumeRawReadResult parses it. |
| 75 | const rawPromise = getMdmRawReadPromise() ?? fireRawRead() |
| 76 | const { mdm, hkcu } = consumeRawReadResult(await rawPromise) |
| 77 | mdmCache = mdm |
| 78 | hkcuCache = hkcu |
| 79 | profileCheckpoint('mdm_load_end') |
| 80 | |
| 81 | const duration = Date.now() - startTime |
| 82 | logForDebugging(`MDM settings load completed in ${duration}ms`) |
| 83 | if (Object.keys(mdm.settings).length > 0) { |
| 84 | logForDebugging( |
| 85 | `MDM settings found: ${Object.keys(mdm.settings).join(', ')}`, |
| 86 | ) |
| 87 | try { |
| 88 | logForDiagnosticsNoPII('info', 'mdm_settings_loaded', { |
| 89 | duration_ms: duration, |
| 90 | key_count: Object.keys(mdm.settings).length, |
| 91 | error_count: mdm.errors.length, |
| 92 | }) |
| 93 | } catch { |
| 94 | // Diagnostic logging is best-effort |
| 95 | } |
| 96 | } |
| 97 | })() |
| 98 | } |
| 99 | |
| 100 | /** |
| 101 | * Await the in-flight MDM load. Call this before the first settings read. |
no test coverage detected