diff options
author | Chocobozzz <me@florianbigard.com> | 2019-08-09 11:32:40 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-08-09 11:32:40 +0200 |
commit | 557b13ae24019d9ab214bbea7eaa0f892c8f4b05 (patch) | |
tree | aa32396531acf93e3dfdb29880177813039ed77f /server/initializers/constants.ts | |
parent | c5407d7046168abb4098df1408e7aa84519cb61a (diff) | |
download | PeerTube-557b13ae24019d9ab214bbea7eaa0f892c8f4b05.tar.gz PeerTube-557b13ae24019d9ab214bbea7eaa0f892c8f4b05.tar.zst PeerTube-557b13ae24019d9ab214bbea7eaa0f892c8f4b05.zip |
Lazy load avatars
Diffstat (limited to 'server/initializers/constants.ts')
-rw-r--r-- | server/initializers/constants.ts | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index b9d90b2bd..3dc178b11 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts | |||
@@ -14,7 +14,7 @@ import { CONFIG, registerConfigChangedHandler } from './config' | |||
14 | 14 | ||
15 | // --------------------------------------------------------------------------- | 15 | // --------------------------------------------------------------------------- |
16 | 16 | ||
17 | const LAST_MIGRATION_VERSION = 415 | 17 | const LAST_MIGRATION_VERSION = 420 |
18 | 18 | ||
19 | // --------------------------------------------------------------------------- | 19 | // --------------------------------------------------------------------------- |
20 | 20 | ||
@@ -498,6 +498,11 @@ const STATIC_DOWNLOAD_PATHS = { | |||
498 | TORRENTS: '/download/torrents/', | 498 | TORRENTS: '/download/torrents/', |
499 | VIDEOS: '/download/videos/' | 499 | VIDEOS: '/download/videos/' |
500 | } | 500 | } |
501 | const LAZY_STATIC_PATHS = { | ||
502 | AVATARS: '/lazy-static/avatars/', | ||
503 | PREVIEWS: '/static/previews/', | ||
504 | VIDEO_CAPTIONS: '/static/video-captions/' | ||
505 | } | ||
501 | 506 | ||
502 | // Cache control | 507 | // Cache control |
503 | let STATIC_MAX_AGE = { | 508 | let STATIC_MAX_AGE = { |
@@ -536,9 +541,12 @@ const FILES_CACHE = { | |||
536 | } | 541 | } |
537 | } | 542 | } |
538 | 543 | ||
539 | const CACHE = { | 544 | const LRU_CACHE = { |
540 | USER_TOKENS: { | 545 | USER_TOKENS: { |
541 | MAX_SIZE: 10000 | 546 | MAX_SIZE: 1000 |
547 | }, | ||
548 | AVATAR_STATIC: { | ||
549 | MAX_SIZE: 500 | ||
542 | } | 550 | } |
543 | } | 551 | } |
544 | 552 | ||
@@ -549,6 +557,10 @@ const MEMOIZE_TTL = { | |||
549 | OVERVIEWS_SAMPLE: 1000 * 3600 * 4 // 4 hours | 557 | OVERVIEWS_SAMPLE: 1000 * 3600 * 4 // 4 hours |
550 | } | 558 | } |
551 | 559 | ||
560 | const QUEUE_CONCURRENCY = { | ||
561 | AVATAR_PROCESS_IMAGE: 3 | ||
562 | } | ||
563 | |||
552 | const REDUNDANCY = { | 564 | const REDUNDANCY = { |
553 | VIDEOS: { | 565 | VIDEOS: { |
554 | RANDOMIZED_FACTOR: 5 | 566 | RANDOMIZED_FACTOR: 5 |
@@ -649,6 +661,7 @@ export { | |||
649 | WEBSERVER, | 661 | WEBSERVER, |
650 | API_VERSION, | 662 | API_VERSION, |
651 | PEERTUBE_VERSION, | 663 | PEERTUBE_VERSION, |
664 | LAZY_STATIC_PATHS, | ||
652 | HLS_REDUNDANCY_DIRECTORY, | 665 | HLS_REDUNDANCY_DIRECTORY, |
653 | P2P_MEDIA_LOADER_PEER_VERSION, | 666 | P2P_MEDIA_LOADER_PEER_VERSION, |
654 | AVATARS_SIZE, | 667 | AVATARS_SIZE, |
@@ -695,11 +708,12 @@ export { | |||
695 | VIDEO_PRIVACIES, | 708 | VIDEO_PRIVACIES, |
696 | VIDEO_LICENCES, | 709 | VIDEO_LICENCES, |
697 | VIDEO_STATES, | 710 | VIDEO_STATES, |
711 | QUEUE_CONCURRENCY, | ||
698 | VIDEO_RATE_TYPES, | 712 | VIDEO_RATE_TYPES, |
699 | VIDEO_TRANSCODING_FPS, | 713 | VIDEO_TRANSCODING_FPS, |
700 | FFMPEG_NICE, | 714 | FFMPEG_NICE, |
701 | VIDEO_ABUSE_STATES, | 715 | VIDEO_ABUSE_STATES, |
702 | CACHE, | 716 | LRU_CACHE, |
703 | JOB_REQUEST_TIMEOUT, | 717 | JOB_REQUEST_TIMEOUT, |
704 | USER_PASSWORD_RESET_LIFETIME, | 718 | USER_PASSWORD_RESET_LIFETIME, |
705 | MEMOIZE_TTL, | 719 | MEMOIZE_TTL, |