Performance and error-handling improvements across shared services#3398
Merged
Performance and error-handling improvements across shared services#3398
Conversation
…ervices Agent-Logs-Url: https://github.com/numbersprotocol/capture-cam/sessions/1e4cc97a-7f48-42f9-b535-d2b5c78e7168 Co-authored-by: numbers-official <181934381+numbers-official@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Improve performance and error-handling in shared services
Performance and error-handling improvements across shared services
Apr 2, 2026
by Olga Shen & Omni
by Olga Shen & Omni
…onnected$ - CaptureTabComponent: programmatic segment assignment via captureTabService now calls markForCheck() to ensure OnPush change detection picks up the new value - NetworkService: remove reconnected$ observable (unused dead code)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Six medium-priority issues across shared services: unnecessary change detection cycles, repeated timestamp computation, TOCTOU race in preference initialization, mutex contention during large file writes, a silently swallowed auth error, and no upload recovery signal on reconnection.
Changes
CaptureTabComponent— AddedChangeDetectionStrategy.OnPushto avoid full tree checks on every proof update.Proof.timestamp— Cached the converted value on first access viaprivate _timestamp?: number. The threshold conversion was a hot path hit on every sort in large collections.CapacitorStoragePreferences.initializeValue()— Wrapped check-and-set inmutex.runExclusive()to close the TOCTOU window where concurrent callers could both pass thesubjects.has(key)guard.MediaStore._write()— Movedbase64ToBlob()outside the mutex. On native platform with large files (10+ MB), blob conversion was holding the lock and blocking concurrent reads.DiaBackendAuthService.getToken()— Replaced brokennew Promise(resolve => ...)pattern with pureasync/await. The original calledrejectfromlodash-es(not the Promise callback), so token-empty errors were silently swallowed. Also removed the now-unusedrejectlodash import.NetworkService— Addedreconnected$observable (usingpairwise+filter) that emits onfalse → trueconnectivity transitions, enabling consumers to trigger automatic upload recovery.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
download.cypress.io/home/REDACTED/work/_temp/ghcca-node/node/bin/node node index.js --exec install conf�� get --global it-cloneD1iQJU/node_modules/.bin/node core.hooksPath(dns block)If you need me to access, download, or install something from one of these locations, you can either: