Commit 3295637
committed
perf: batch cold-cache pre-warm in mergeCollectionWithPatches via multiGet
Replaces the unconditional Promise.all(existingKeys.map(get)) pre-warm
with a hybrid:
- Fast path (every existingKey is already in cache): use a sync-
resolved Promise — no extra microtask hops, preserving the original
promise-chain depth and subscriber-callback timing that dependent
tests rely on (Onyx.update batch tests broadcast a single merged
callback rather than an `undefined` initial followed by the merged
result).
- Slow path (at least one cache-miss existingKey): use multiGet —
one Storage.multiGet round-trip for the missing keys instead of N
parallel get() invocations.
Net result: same correctness as before, fewer storage operations on
cold-cache merges, identical broadcast timing for warm-cache merges.
Addresses follow-up from #787 review.1 parent b506f32 commit 3295637
1 file changed
Lines changed: 14 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1597 | 1597 | | |
1598 | 1598 | | |
1599 | 1599 | | |
1600 | | - | |
1601 | | - | |
1602 | | - | |
1603 | | - | |
1604 | | - | |
1605 | | - | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
| 1604 | + | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
1606 | 1614 | | |
1607 | 1615 | | |
1608 | 1616 | | |
| |||
0 commit comments