mirror of
https://git.sr.ht/~cadence/bibliogram
synced 2024-11-22 16:17:29 +00:00
Add reel to request history
This commit is contained in:
parent
272f4b6e3b
commit
81fb064318
@ -10,7 +10,7 @@ require("./testimports")(constants, request, extractSharedData, RequestCache, Re
|
|||||||
const requestCache = new RequestCache(constants.caching.resource_cache_time)
|
const requestCache = new RequestCache(constants.caching.resource_cache_time)
|
||||||
/** @type {import("./cache").TtlCache<import("./structures/TimelineEntry")>} */
|
/** @type {import("./cache").TtlCache<import("./structures/TimelineEntry")>} */
|
||||||
const timelineEntryCache = new TtlCache(constants.caching.resource_cache_time)
|
const timelineEntryCache = new TtlCache(constants.caching.resource_cache_time)
|
||||||
const history = new RequestHistory(["user", "timeline", "post"])
|
const history = new RequestHistory(["user", "timeline", "post", "reel"])
|
||||||
|
|
||||||
async function fetchUser(username) {
|
async function fetchUser(username) {
|
||||||
if (constants.allow_user_from_reel === "never") {
|
if (constants.allow_user_from_reel === "never") {
|
||||||
@ -92,7 +92,13 @@ function fetchUserFromCombined(userID, username) {
|
|||||||
const page = await fetchTimelinePage(userID, "")
|
const page = await fetchTimelinePage(userID, "")
|
||||||
user.timeline.addPage(page)
|
user.timeline.addPage(page)
|
||||||
}
|
}
|
||||||
|
history.report("reel", true)
|
||||||
return user
|
return user
|
||||||
|
}).catch(error => {
|
||||||
|
if (error === constants.symbols.RATE_LIMITED) {
|
||||||
|
history.report("reel", false)
|
||||||
|
}
|
||||||
|
throw error
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user