Cache enhancements:

- Use quota for /p/ requests
- Correctly detect owner.full_name to save unneeded requests out
- Unify quota reached pages
- Unify post presentation into function that fetches prerequisites
- Add getByID method to userRequestCache
This commit is contained in:
Cadence Ember
2020-07-29 21:51:41 +12:00
parent 736de3063a
commit 44c8e96a94
7 changed files with 145 additions and 80 deletions

View File

@@ -380,12 +380,12 @@ function getOrCreateShortcode(shortcode) {
async function getOrFetchShortcode(shortcode) {
if (timelineEntryCache.has(shortcode)) {
return timelineEntryCache.get(shortcode)
return {post: timelineEntryCache.get(shortcode), fromCache: true}
} else {
const data = await fetchShortcodeData(shortcode)
const {result, fromCache} = await fetchShortcodeData(shortcode)
const entry = getOrCreateShortcode(shortcode)
entry.applyN3(data.result)
return entry
entry.applyN3(result)
return {post: entry, fromCache}
}
}