EpubPageCacheService.clear() empties the LRU Map and the in-flight Map, but it does not unsubscribe the live getEpubPage pipes.
Those pipes still tap((content) => this.store(key, content)) when the network responds. After a reader calls clear() (e.g. book change / logout), a late in-flight page is written back into the cache. A subsequent get() for that key then serves the stale book’s HTML without hitting the network.
Repro (unit):
get(book, 7) with a pending Subject
clear()
Subject emits
get(book, 7) is a cache hit — no ReaderService.getEpubPage call
Fix: keep a Subscription (or takeUntil) per in-flight key and unsubscribe in clear(), or drop the tap store when the cache generation has changed.
`EpubPageCacheService.clear()` empties the LRU Map and the in-flight Map, but it does **not** unsubscribe the live `getEpubPage` pipes.
Those pipes still `tap((content) => this.store(key, content))` when the network responds. After a reader calls `clear()` (e.g. book change / logout), a late in-flight page is written back into the cache. A subsequent `get()` for that key then serves the stale book’s HTML without hitting the network.
Repro (unit):
1. `get(book, 7)` with a pending Subject
2. `clear()`
3. Subject emits
4. `get(book, 7)` is a cache hit — no `ReaderService.getEpubPage` call
Fix: keep a Subscription (or `takeUntil`) per in-flight key and unsubscribe in `clear()`, or drop the `tap` store when the cache generation has changed.
Resolved in spikersoft-angular PR #818 (merged to master). EpubPageCacheService.clear() now unsubscribes in-flight fetches so a late page cannot refill the LRU. Closing.
Resolved in spikersoft-angular [PR #818](https://git.spikersoft.com/spikerj/spikersoft-angular/pulls/818) (merged to `master`). `EpubPageCacheService.clear()` now unsubscribes in-flight fetches so a late page cannot refill the LRU. Closing.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
EpubPageCacheService.clear()empties the LRU Map and the in-flight Map, but it does not unsubscribe the livegetEpubPagepipes.Those pipes still
tap((content) => this.store(key, content))when the network responds. After a reader callsclear()(e.g. book change / logout), a late in-flight page is written back into the cache. A subsequentget()for that key then serves the stale book’s HTML without hitting the network.Repro (unit):
get(book, 7)with a pending Subjectclear()get(book, 7)is a cache hit — noReaderService.getEpubPagecallFix: keep a Subscription (or
takeUntil) per in-flight key and unsubscribe inclear(), or drop thetapstore when the cache generation has changed.Resolved in spikersoft-angular PR #818 (merged to
master).EpubPageCacheService.clear()now unsubscribes in-flight fetches so a late page cannot refill the LRU. Closing.