1
0
mirror of https://git.sr.ht/~cadence/bibliogram synced 2024-11-23 00:27:30 +00:00

Add reel to request history

This commit is contained in:
Cadence Fish 2020-02-03 02:44:52 +13:00
parent 272f4b6e3b
commit 81fb064318
No known key found for this signature in database
GPG Key ID: 81015DF9AA8607E1

View File

@ -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
}) })
} }