Closed yousif-bugsnag closed 3 months ago
NPM build
Package | |
---|---|
Before | 191.20 kB |
After | 191.20 kB |
± | No change |
CDN build
Unminified | Minfied | Minified + gzipped | |
---|---|---|---|
Before | 95.92 kB |
35.88 kB |
10.87 kB |
After | 95.92 kB |
35.88 kB |
10.87 kB |
± | No change | No change | No change |
Ok | File (✨=New File) | Lines | Branches | Functions | Statements |
---|---|---|---|---|---|
🔴 | /home/runner/work/bugsnag-js-performance/bugsnag-js-performance/packages/platforms/react-native/lib/retry-queue/directory.ts | 94.59% (+0.31%) |
0% (+0%) |
100% (+0%) |
95.34% (+0.22%) |
✅ | /home/runner/work/bugsnag-js-performance/bugsnag-js-performance/packages/platforms/react-native/lib/retry-queue/file-based.ts | 97.72% (+0.05%) |
100% (+0%) |
100% (+0%) |
97.95% (+0.04%) |
Total:
Lines | Branches | Functions | Statements |
---|---|---|---|
86.97%(+0.02%) | 78.13%(-0.07%) | 87.74%(+0%) | 83.68%(+0.03%) |
Generated against 06c1cfb360fcbfb7606f0d1f58c4ec34f601ef5b on 6 August 2024 at 09:48:36 UTC
Goal
Replace usage of BigInt in the react native retry queue as this isn't supported on older versions of React Native (or more specifically on older versions of Hermes).
Design
Instead of using nanosecond timestamps based on the largest span end time in the payload, the retry queue now uses the time the payload was added to the queue (in ms) for the filename. This is already being passed to
FileBasedRetryQueue#add
by the batch processor, but was previously an unused parameter.Although it shouldn't really be possible for two files to be created with the same timestamp (as the time is recorded when a batch is flushed and a failed batch is only ever added to the retry queue once), the span ID of the last span in the payload is still used in the filename to ensure filenames are unique.
This also ensures backwards compatibility - the
timestampFromFilename
function used to parse filenames now simply returns a number instead of a bigint, so any existing retry files using nanosecond timestamps will still be parsed.Testing
Updated unit tests and relied on existing e2e tests