Incorrect amount of bugs shown (due to cache) #2889
szmarczak posted onGitHub
Cache. It expires within an hour and is refreshed in the next pageload
Well then it should update when somebody clicks on the tab, right?
I’m thinking of changing the cache API so that you could set the cache manually in these cases. For example:
const countBugs = cache.function(…, {options});
…
if (isBugsPage) {
countBugs.set(getCountFromDom()); // this sets the cache using the options already defined for cache.function
// instead of
// const key = xxx
// const expiration = maxAge + staleWhileRevalidate
// await cache.set(key, getCountFromDom(), expiration)
}
const bugs = await countBugs()
cc @sindresorhus a new API isn’t strictly necessary, but it helps reuse the logic/options without having to manually create additional constants.
API suggestions welcome
Cache. It expires within an hour and is refreshed in the next pageload
It never expires on my side. It has been days and I'm still seeing 1
. Reload doesn't do anything.
Chrome or Firefox?
Try this in the background script inspector
await browser.storage.get('bugs-tab:szmarczak/cacheable-lookup')
What’s the result of this?
The cache should be there for 4 days, but if you reload the page twice after half an hour it should be expired/updated. So if you load the page now it should definitely show 0, otherwise it’s not working as expected
Chrome or Firefox?
Chrome.
So if you load the page now it should definitely show 0, otherwise it’s not working as expected
It still shows 1
.
My bad,
await browser.storage.local.get('bugs-tab:szmarczak/cacheable-lookup')
I suggesting emptying the cache, it's at the bottom of the options page
Yep, that worked!
Why has this been closed? Is it fixed already?