aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers/constants.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-01-11 09:35:50 +0100
committerChocobozzz <me@florianbigard.com>2018-01-11 09:35:50 +0100
commit60650c77c8a2a98e92d869b237ae4900f369a8fc (patch)
tree7304a7591b5b23b99d219c4d06c6bd5c4c58c1c2 /server/initializers/constants.ts
parent7ae71355c40e9065f83d3fc77b6750d1929ac201 (diff)
downloadPeerTube-60650c77c8a2a98e92d869b237ae4900f369a8fc.tar.gz
PeerTube-60650c77c8a2a98e92d869b237ae4900f369a8fc.tar.zst
PeerTube-60650c77c8a2a98e92d869b237ae4900f369a8fc.zip
Add scores to follows and remove bad ones
Diffstat (limited to 'server/initializers/constants.ts')
-rw-r--r--server/initializers/constants.ts21
1 files changed, 13 insertions, 8 deletions
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index c735e6daf..0c139912c 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -9,7 +9,7 @@ import { isTestInstance, root, sanitizeHost, sanitizeUrl } from '../helpers/core
9 9
10// --------------------------------------------------------------------------- 10// ---------------------------------------------------------------------------
11 11
12const LAST_MIGRATION_VERSION = 165 12const LAST_MIGRATION_VERSION = 170
13 13
14// --------------------------------------------------------------------------- 14// ---------------------------------------------------------------------------
15 15
@@ -40,12 +40,12 @@ const OAUTH_LIFETIME = {
40 40
41// --------------------------------------------------------------------------- 41// ---------------------------------------------------------------------------
42 42
43// Number of points we add/remove from a friend after a successful/bad request 43// Number of points we add/remove after a successful/bad request
44const SERVERS_SCORE = { 44const ACTOR_FOLLOW_SCORE = {
45 PENALTY: -10, 45 PENALTY: -10,
46 BONUS: 10, 46 BONUS: 10,
47 BASE: 100, 47 BASE: 1000,
48 MAX: 1000 48 MAX: 10000
49} 49}
50 50
51const FOLLOW_STATES: { [ id: string ]: FollowState } = { 51const FOLLOW_STATES: { [ id: string ]: FollowState } = {
@@ -76,6 +76,9 @@ const JOBS_FETCH_LIMIT_PER_CYCLE = {
76// 1 minutes 76// 1 minutes
77let JOBS_FETCHING_INTERVAL = 60000 77let JOBS_FETCHING_INTERVAL = 60000
78 78
79// 1 hour
80let SCHEDULER_INTERVAL = 60000 * 60
81
79// --------------------------------------------------------------------------- 82// ---------------------------------------------------------------------------
80 83
81const CONFIG = { 84const CONFIG = {
@@ -346,7 +349,7 @@ const OPENGRAPH_AND_OEMBED_COMMENT = '<!-- open graph and oembed tags -->'
346 349
347// Special constants for a test instance 350// Special constants for a test instance
348if (isTestInstance() === true) { 351if (isTestInstance() === true) {
349 SERVERS_SCORE.BASE = 20 352 ACTOR_FOLLOW_SCORE.BASE = 20
350 JOBS_FETCHING_INTERVAL = 1000 353 JOBS_FETCHING_INTERVAL = 1000
351 REMOTE_SCHEME.HTTP = 'http' 354 REMOTE_SCHEME.HTTP = 'http'
352 REMOTE_SCHEME.WS = 'ws' 355 REMOTE_SCHEME.WS = 'ws'
@@ -354,6 +357,7 @@ if (isTestInstance() === true) {
354 ACTIVITY_PUB.COLLECTION_ITEMS_PER_PAGE = 2 357 ACTIVITY_PUB.COLLECTION_ITEMS_PER_PAGE = 2
355 ACTIVITY_PUB.ACTOR_REFRESH_INTERVAL = 60 // 1 minute 358 ACTIVITY_PUB.ACTOR_REFRESH_INTERVAL = 60 // 1 minute
356 CONSTRAINTS_FIELDS.ACTORS.AVATAR.FILE_SIZE.max = 100 * 1024 // 100KB 359 CONSTRAINTS_FIELDS.ACTORS.AVATAR.FILE_SIZE.max = 100 * 1024 // 100KB
360 SCHEDULER_INTERVAL = 10000
357} 361}
358 362
359CONFIG.WEBSERVER.URL = sanitizeUrl(CONFIG.WEBSERVER.SCHEME + '://' + CONFIG.WEBSERVER.HOSTNAME + ':' + CONFIG.WEBSERVER.PORT) 363CONFIG.WEBSERVER.URL = sanitizeUrl(CONFIG.WEBSERVER.SCHEME + '://' + CONFIG.WEBSERVER.HOSTNAME + ':' + CONFIG.WEBSERVER.PORT)
@@ -378,7 +382,7 @@ export {
378 OAUTH_LIFETIME, 382 OAUTH_LIFETIME,
379 OPENGRAPH_AND_OEMBED_COMMENT, 383 OPENGRAPH_AND_OEMBED_COMMENT,
380 PAGINATION_COUNT_DEFAULT, 384 PAGINATION_COUNT_DEFAULT,
381 SERVERS_SCORE, 385 ACTOR_FOLLOW_SCORE,
382 PREVIEWS_SIZE, 386 PREVIEWS_SIZE,
383 REMOTE_SCHEME, 387 REMOTE_SCHEME,
384 FOLLOW_STATES, 388 FOLLOW_STATES,
@@ -396,5 +400,6 @@ export {
396 VIDEO_LICENCES, 400 VIDEO_LICENCES,
397 VIDEO_RATE_TYPES, 401 VIDEO_RATE_TYPES,
398 VIDEO_MIMETYPE_EXT, 402 VIDEO_MIMETYPE_EXT,
399 AVATAR_MIMETYPE_EXT 403 AVATAR_MIMETYPE_EXT,
404 SCHEDULER_INTERVAL
400} 405}