aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers/constants.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-11-23 17:13:01 +0100
committerChocobozzz <me@florianbigard.com>2022-11-23 17:13:01 +0100
commitc3b21b68b55fa5cb0ee7a23e4316b5466a0448f0 (patch)
tree8b7d0be8a57dc9a57a6f9d3af4a69578f06c0c4c /server/initializers/constants.ts
parent5800f354ccd4845d0b4bc212a0c53a0ff40edf82 (diff)
downloadPeerTube-c3b21b68b55fa5cb0ee7a23e4316b5466a0448f0.tar.gz
PeerTube-c3b21b68b55fa5cb0ee7a23e4316b5466a0448f0.tar.zst
PeerTube-c3b21b68b55fa5cb0ee7a23e4316b5466a0448f0.zip
Delete completed/failed jobs directly from bullmq
Diffstat (limited to 'server/initializers/constants.ts')
-rw-r--r--server/initializers/constants.ts22
1 files changed, 20 insertions, 2 deletions
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index 991fe3e85..c8fa8fa2c 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -239,7 +239,23 @@ const REQUEST_TIMEOUTS = {
239 REDUNDANCY: JOB_TTL['video-redundancy'] 239 REDUNDANCY: JOB_TTL['video-redundancy']
240} 240}
241 241
242const JOB_COMPLETED_LIFETIME = 60000 * 60 * 24 * 2 // 2 days 242const JOB_REMOVAL_OPTIONS = {
243 COUNT: 10000, // Max jobs to store
244
245 SUCCESS: { // Success jobs
246 'DEFAULT': parseDurationToMs('2 days'),
247
248 'activitypub-http-broadcast-parallel': parseDurationToMs('10 minutes'),
249 'activitypub-http-unicast': parseDurationToMs('1 hour'),
250 'videos-views-stats': parseDurationToMs('3 hours'),
251 'activitypub-refresher': parseDurationToMs('10 hours')
252 },
253
254 FAILURE: { // Failed job
255 DEFAULT: parseDurationToMs('7 days')
256 }
257}
258
243const VIDEO_IMPORT_TIMEOUT = Math.floor(JOB_TTL['video-import'] * 0.9) 259const VIDEO_IMPORT_TIMEOUT = Math.floor(JOB_TTL['video-import'] * 0.9)
244 260
245const SCHEDULER_INTERVALS_MS = { 261const SCHEDULER_INTERVALS_MS = {
@@ -938,6 +954,8 @@ if (process.env.PRODUCTION_CONSTANTS !== 'true') {
938 OVERVIEWS.VIDEOS.SAMPLE_THRESHOLD = 2 954 OVERVIEWS.VIDEOS.SAMPLE_THRESHOLD = 2
939 955
940 PLUGIN_EXTERNAL_AUTH_TOKEN_LIFETIME = 5000 956 PLUGIN_EXTERNAL_AUTH_TOKEN_LIFETIME = 5000
957
958 JOB_REMOVAL_OPTIONS.SUCCESS['videos-views-stats'] = 10000
941 } 959 }
942 960
943 if (isTestInstance()) { 961 if (isTestInstance()) {
@@ -1069,7 +1087,7 @@ export {
1069 CRAWL_REQUEST_CONCURRENCY, 1087 CRAWL_REQUEST_CONCURRENCY,
1070 DEFAULT_AUDIO_RESOLUTION, 1088 DEFAULT_AUDIO_RESOLUTION,
1071 BINARY_CONTENT_TYPES, 1089 BINARY_CONTENT_TYPES,
1072 JOB_COMPLETED_LIFETIME, 1090 JOB_REMOVAL_OPTIONS,
1073 HTTP_SIGNATURE, 1091 HTTP_SIGNATURE,
1074 VIDEO_IMPORT_STATES, 1092 VIDEO_IMPORT_STATES,
1075 VIDEO_CHANNEL_SYNC_STATE, 1093 VIDEO_CHANNEL_SYNC_STATE,