aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-04-24 17:19:00 +0200
committerChocobozzz <me@florianbigard.com>2019-04-24 17:29:19 +0200
commit8519cc92341545468104f0704fff64a05c84bec0 (patch)
treede67ec4981ae2ce74d7a12c1adad5883f90fc7f5 /server/middlewares
parent9ce3d3027ed7253fbd4fe46787eda58c51549444 (diff)
downloadPeerTube-8519cc92341545468104f0704fff64a05c84bec0.tar.gz
PeerTube-8519cc92341545468104f0704fff64a05c84bec0.tar.zst
PeerTube-8519cc92341545468104f0704fff64a05c84bec0.zip
Fix overview endpoint
Diffstat (limited to 'server/middlewares')
-rw-r--r--server/middlewares/cache.ts3
1 files changed, 2 insertions, 1 deletions
diff --git a/server/middlewares/cache.ts b/server/middlewares/cache.ts
index e83d8d569..091c82d92 100644
--- a/server/middlewares/cache.ts
+++ b/server/middlewares/cache.ts
@@ -7,6 +7,8 @@ import { logger } from '../helpers/logger'
7const lock = new AsyncLock({ timeout: 5000 }) 7const lock = new AsyncLock({ timeout: 5000 })
8 8
9function cacheRoute (lifetimeArg: string | number) { 9function cacheRoute (lifetimeArg: string | number) {
10 const lifetime = parseDurationToMs(lifetimeArg)
11
10 return async function (req: express.Request, res: express.Response, next: express.NextFunction) { 12 return async function (req: express.Request, res: express.Response, next: express.NextFunction) {
11 const redisKey = Redis.Instance.generateCachedRouteKey(req) 13 const redisKey = Redis.Instance.generateCachedRouteKey(req)
12 14
@@ -24,7 +26,6 @@ function cacheRoute (lifetimeArg: string | number) {
24 res.send = (body) => { 26 res.send = (body) => {
25 if (res.statusCode >= 200 && res.statusCode < 400) { 27 if (res.statusCode >= 200 && res.statusCode < 400) {
26 const contentType = res.get('content-type') 28 const contentType = res.get('content-type')
27 const lifetime = parseDurationToMs(lifetimeArg)
28 29
29 Redis.Instance.setCachedRoute(req, body, lifetime, contentType, res.statusCode) 30 Redis.Instance.setCachedRoute(req, body, lifetime, contentType, res.statusCode)
30 .then(() => done()) 31 .then(() => done())