()
| 17 | } |
| 18 | |
| 19 | async function main(): Promise<void> { |
| 20 | if (!parentPort) throw new Error('contacts worker requires parentPort') |
| 21 | const options = workerData as ContactsWorkerStartupOptions |
| 22 | initAppLogger(options.paths.logsDir) |
| 23 | const pathProvider = new StaticPathProvider(options.paths) |
| 24 | const dbManager = new DatabaseManager(pathProvider, { |
| 25 | nativeBinding: options.nativeBinding, |
| 26 | runtime: options.runtimeIdentity, |
| 27 | allowMissingRuntimeForTests: !options.runtimeIdentity, |
| 28 | }) |
| 29 | const adapter = createDatabaseManagerAdapter(dbManager) |
| 30 | const onProgress = (progress: ContactsComputeProgress) => parentPort?.postMessage({ type: 'progress', progress }) |
| 31 | const snapshot = computeContactsSnapshot({ |
| 32 | adapter, |
| 33 | signature: options.signature, |
| 34 | timeRangePreset: options.timeRangePreset, |
| 35 | factsCacheDir: getContactsFactsCacheDir(pathProvider.getUserDataDir()), |
| 36 | onProgress, |
| 37 | }) |
| 38 | parentPort.postMessage({ type: 'success', snapshot }) |
| 39 | } |
| 40 | |
| 41 | main().catch((error) => { |
| 42 | parentPort?.postMessage({ |
no test coverage detected