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
1 changed files with 7 additions and 1 deletions

View File

@ -10,7 +10,7 @@ require("./testimports")(constants, request, extractSharedData, RequestCache, Re
const requestCache = new RequestCache(constants.caching.resource_cache_time)
/** @type {import("./cache").TtlCache<import("./structures/TimelineEntry")>} */
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) {
if (constants.allow_user_from_reel === "never") {
@ -92,7 +92,13 @@ function fetchUserFromCombined(userID, username) {
const page = await fetchTimelinePage(userID, "")
user.timeline.addPage(page)
}
history.report("reel", true)
return user
}).catch(error => {
if (error === constants.symbols.RATE_LIMITED) {
history.report("reel", false)
}
throw error
})
}