1
0
mirror of https://git.sr.ht/~cadence/bibliogram synced 2025-12-16 11:08:49 +00:00

Cache some semi-static data

This commit is contained in:
Cadence Ember
2020-05-04 23:50:54 +12:00
parent 8c2a4454f2
commit 12c02fd8af
7 changed files with 12 additions and 8 deletions

View File

@@ -2,7 +2,7 @@ const constants = require("../../lib/constants")
const {Feed} = require("feed")
const {getFeedSetup} = require("../../lib/utils/feed")
const {fetchUser, userRequestCache} = require("../../lib/collectors")
const {render} = require("pinski/plugins")
const {render, getStaticURL} = require("pinski/plugins")
const {pugCache} = require("../passthrough")
const {compile} = require("pug")
@@ -80,7 +80,8 @@ module.exports = [
"Retry-After": userRequestCache.getTtl("user/"+fill[0], 1000)
},
content: pugCache.get("pug/blocked.pug").web({
expiresMinutes: userRequestCache.getTtl("user/"+fill[0], 1000*60)
expiresMinutes: userRequestCache.getTtl("user/"+fill[0], 1000*60),
getStaticURL
})
}
} else if (error === constants.symbols.extractor_results.AGE_RESTRICTED) {

View File

@@ -1,7 +1,7 @@
const constants = require("../../lib/constants")
const switcher = require("../../lib/utils/torswitcher")
const {fetchUser, getOrFetchShortcode, userRequestCache, history} = require("../../lib/collectors")
const {render, redirect} = require("pinski/plugins")
const {render, redirect, getStaticURL} = require("pinski/plugins")
const {pugCache} = require("../passthrough")
/** @param {import("../../lib/structures/TimelineEntry")} post */
@@ -86,7 +86,8 @@ module.exports = [
"Retry-After": userRequestCache.getTtl("user/"+fill[0], 1000)
},
content: pugCache.get("pug/blocked.pug").web({
expiresMinutes: userRequestCache.getTtl("user/"+fill[0], 1000*60)
expiresMinutes: userRequestCache.getTtl("user/"+fill[0], 1000*60),
getStaticURL
})
}
} else if (error === constants.symbols.extractor_results.AGE_RESTRICTED) {