diff options
author | Chocobozzz <me@florianbigard.com> | 2019-04-11 15:38:53 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-04-11 15:38:53 +0200 |
commit | 8f0bc73d7d5f4c88cbc5588a0ece12b3855c8f98 (patch) | |
tree | e04f1da52f9377cf6ce820425c0de6e57ab57fc6 /server/middlewares/cache.ts | |
parent | 76062d9f96e06a23a2efc8a727ea9c5394d21466 (diff) | |
download | PeerTube-8f0bc73d7d5f4c88cbc5588a0ece12b3855c8f98.tar.gz PeerTube-8f0bc73d7d5f4c88cbc5588a0ece12b3855c8f98.tar.zst PeerTube-8f0bc73d7d5f4c88cbc5588a0ece12b3855c8f98.zip |
Add ability to limit videos history size
Diffstat (limited to 'server/middlewares/cache.ts')
-rw-r--r-- | server/middlewares/cache.ts | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/server/middlewares/cache.ts b/server/middlewares/cache.ts index 8ffe75700..e83d8d569 100644 --- a/server/middlewares/cache.ts +++ b/server/middlewares/cache.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import * as AsyncLock from 'async-lock' | 2 | import * as AsyncLock from 'async-lock' |
3 | import { parseDuration } from '../helpers/core-utils' | 3 | import { parseDurationToMs } from '../helpers/core-utils' |
4 | import { Redis } from '../lib/redis' | 4 | import { Redis } from '../lib/redis' |
5 | import { logger } from '../helpers/logger' | 5 | import { logger } from '../helpers/logger' |
6 | 6 | ||
@@ -24,7 +24,7 @@ function cacheRoute (lifetimeArg: string | number) { | |||
24 | res.send = (body) => { | 24 | res.send = (body) => { |
25 | if (res.statusCode >= 200 && res.statusCode < 400) { | 25 | if (res.statusCode >= 200 && res.statusCode < 400) { |
26 | const contentType = res.get('content-type') | 26 | const contentType = res.get('content-type') |
27 | const lifetime = parseDuration(lifetimeArg) | 27 | const lifetime = parseDurationToMs(lifetimeArg) |
28 | 28 | ||
29 | Redis.Instance.setCachedRoute(req, body, lifetime, contentType, res.statusCode) | 29 | Redis.Instance.setCachedRoute(req, body, lifetime, contentType, res.statusCode) |
30 | .then(() => done()) | 30 | .then(() => done()) |