aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers/constants.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-02-26 16:26:27 +0100
committerChocobozzz <me@florianbigard.com>2021-03-03 10:08:08 +0100
commit74d249bc1346c7cfaac7ee49bebbebcf2a01f82a (patch)
treed47bd163ae57ed8f15b445296634cc04f4f67b6f /server/initializers/constants.ts
parent095e2258043fcff8a79ab082d11edfbd8f13a8e2 (diff)
downloadPeerTube-74d249bc1346c7cfaac7ee49bebbebcf2a01f82a.tar.gz
PeerTube-74d249bc1346c7cfaac7ee49bebbebcf2a01f82a.tar.zst
PeerTube-74d249bc1346c7cfaac7ee49bebbebcf2a01f82a.zip
Add ability to cleanup remote AP interactions
Diffstat (limited to 'server/initializers/constants.ts')
-rw-r--r--server/initializers/constants.ts12
1 files changed, 11 insertions, 1 deletions
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index 74192d590..083a29889 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -137,6 +137,7 @@ const JOB_ATTEMPTS: { [id in JobType]: number } = {
137 'activitypub-http-unicast': 5, 137 'activitypub-http-unicast': 5,
138 'activitypub-http-fetcher': 5, 138 'activitypub-http-fetcher': 5,
139 'activitypub-follow': 5, 139 'activitypub-follow': 5,
140 'activitypub-cleaner': 1,
140 'video-file-import': 1, 141 'video-file-import': 1,
141 'video-transcoding': 1, 142 'video-transcoding': 1,
142 'video-import': 1, 143 'video-import': 1,
@@ -147,10 +148,12 @@ const JOB_ATTEMPTS: { [id in JobType]: number } = {
147 'video-redundancy': 1, 148 'video-redundancy': 1,
148 'video-live-ending': 1 149 'video-live-ending': 1
149} 150}
150const JOB_CONCURRENCY: { [id in JobType]?: number } = { 151// Excluded keys are jobs that can be configured by admins
152const JOB_CONCURRENCY: { [id in Exclude<JobType, 'video-transcoding' | 'video-import'>]: number } = {
151 'activitypub-http-broadcast': 1, 153 'activitypub-http-broadcast': 1,
152 'activitypub-http-unicast': 5, 154 'activitypub-http-unicast': 5,
153 'activitypub-http-fetcher': 1, 155 'activitypub-http-fetcher': 1,
156 'activitypub-cleaner': 1,
154 'activitypub-follow': 1, 157 'activitypub-follow': 1,
155 'video-file-import': 1, 158 'video-file-import': 1,
156 'email': 5, 159 'email': 5,
@@ -165,6 +168,7 @@ const JOB_TTL: { [id in JobType]: number } = {
165 'activitypub-http-unicast': 60000 * 10, // 10 minutes 168 'activitypub-http-unicast': 60000 * 10, // 10 minutes
166 'activitypub-http-fetcher': 1000 * 3600 * 10, // 10 hours 169 'activitypub-http-fetcher': 1000 * 3600 * 10, // 10 hours
167 'activitypub-follow': 60000 * 10, // 10 minutes 170 'activitypub-follow': 60000 * 10, // 10 minutes
171 'activitypub-cleaner': 1000 * 3600, // 1 hour
168 'video-file-import': 1000 * 3600, // 1 hour 172 'video-file-import': 1000 * 3600, // 1 hour
169 'video-transcoding': 1000 * 3600 * 48, // 2 days, transcoding could be long 173 'video-transcoding': 1000 * 3600 * 48, // 2 days, transcoding could be long
170 'video-import': 1000 * 3600 * 2, // 2 hours 174 'video-import': 1000 * 3600 * 2, // 2 hours
@@ -178,6 +182,9 @@ const JOB_TTL: { [id in JobType]: number } = {
178const REPEAT_JOBS: { [ id: string ]: EveryRepeatOptions | CronRepeatOptions } = { 182const REPEAT_JOBS: { [ id: string ]: EveryRepeatOptions | CronRepeatOptions } = {
179 'videos-views': { 183 'videos-views': {
180 cron: randomInt(1, 20) + ' * * * *' // Between 1-20 minutes past the hour 184 cron: randomInt(1, 20) + ' * * * *' // Between 1-20 minutes past the hour
185 },
186 'activitypub-cleaner': {
187 cron: '30 5 * * ' + randomInt(0, 7) // 1 time per week (random day) at 5:30 AM
181 } 188 }
182} 189}
183const JOB_PRIORITY = { 190const JOB_PRIORITY = {
@@ -188,6 +195,7 @@ const JOB_PRIORITY = {
188} 195}
189 196
190const BROADCAST_CONCURRENCY = 10 // How many requests in parallel we do in activitypub-http-broadcast job 197const BROADCAST_CONCURRENCY = 10 // How many requests in parallel we do in activitypub-http-broadcast job
198const AP_CLEANER_CONCURRENCY = 10 // How many requests in parallel we do in activitypub-cleaner job
191const CRAWL_REQUEST_CONCURRENCY = 1 // How many requests in parallel to fetch remote data (likes, shares...) 199const CRAWL_REQUEST_CONCURRENCY = 1 // How many requests in parallel to fetch remote data (likes, shares...)
192const JOB_REQUEST_TIMEOUT = 7000 // 7 seconds 200const JOB_REQUEST_TIMEOUT = 7000 // 7 seconds
193const JOB_COMPLETED_LIFETIME = 60000 * 60 * 24 * 2 // 2 days 201const JOB_COMPLETED_LIFETIME = 60000 * 60 * 24 * 2 // 2 days
@@ -756,6 +764,7 @@ if (isTestInstance() === true) {
756 SCHEDULER_INTERVALS_MS.autoFollowIndexInstances = 5000 764 SCHEDULER_INTERVALS_MS.autoFollowIndexInstances = 5000
757 SCHEDULER_INTERVALS_MS.updateInboxStats = 5000 765 SCHEDULER_INTERVALS_MS.updateInboxStats = 5000
758 REPEAT_JOBS['videos-views'] = { every: 5000 } 766 REPEAT_JOBS['videos-views'] = { every: 5000 }
767 REPEAT_JOBS['activitypub-cleaner'] = { every: 5000 }
759 768
760 REDUNDANCY.VIDEOS.RANDOMIZED_FACTOR = 1 769 REDUNDANCY.VIDEOS.RANDOMIZED_FACTOR = 1
761 770
@@ -815,6 +824,7 @@ export {
815 REDUNDANCY, 824 REDUNDANCY,
816 JOB_CONCURRENCY, 825 JOB_CONCURRENCY,
817 JOB_ATTEMPTS, 826 JOB_ATTEMPTS,
827 AP_CLEANER_CONCURRENCY,
818 LAST_MIGRATION_VERSION, 828 LAST_MIGRATION_VERSION,
819 OAUTH_LIFETIME, 829 OAUTH_LIFETIME,
820 CUSTOM_HTML_TAG_COMMENTS, 830 CUSTOM_HTML_TAG_COMMENTS,