aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/schedulers
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/schedulers')
-rw-r--r--server/lib/schedulers/auto-follow-index-instances.ts16
1 files changed, 7 insertions, 9 deletions
diff --git a/server/lib/schedulers/auto-follow-index-instances.ts b/server/lib/schedulers/auto-follow-index-instances.ts
index a57436a45..f62f52f9c 100644
--- a/server/lib/schedulers/auto-follow-index-instances.ts
+++ b/server/lib/schedulers/auto-follow-index-instances.ts
@@ -1,12 +1,12 @@
1import { logger } from '../../helpers/logger'
2import { AbstractScheduler } from './abstract-scheduler'
3import { INSTANCES_INDEX, SCHEDULER_INTERVALS_MS, SERVER_ACTOR_NAME } from '../../initializers/constants'
4import { CONFIG } from '../../initializers/config'
5import { chunk } from 'lodash' 1import { chunk } from 'lodash'
6import { doRequest } from '@server/helpers/requests' 2import { doRequest } from '@server/helpers/requests'
7import { ActorFollowModel } from '@server/models/activitypub/actor-follow'
8import { JobQueue } from '@server/lib/job-queue' 3import { JobQueue } from '@server/lib/job-queue'
4import { ActorFollowModel } from '@server/models/activitypub/actor-follow'
9import { getServerActor } from '@server/models/application/application' 5import { getServerActor } from '@server/models/application/application'
6import { logger } from '../../helpers/logger'
7import { CONFIG } from '../../initializers/config'
8import { SCHEDULER_INTERVALS_MS, SERVER_ACTOR_NAME } from '../../initializers/constants'
9import { AbstractScheduler } from './abstract-scheduler'
10 10
11export class AutoFollowIndexInstances extends AbstractScheduler { 11export class AutoFollowIndexInstances extends AbstractScheduler {
12 12
@@ -34,16 +34,14 @@ export class AutoFollowIndexInstances extends AbstractScheduler {
34 try { 34 try {
35 const serverActor = await getServerActor() 35 const serverActor = await getServerActor()
36 36
37 const uri = indexUrl + INSTANCES_INDEX.HOSTS_PATH
38
39 const qs = { count: 1000 } 37 const qs = { count: 1000 }
40 if (this.lastCheck) Object.assign(qs, { since: this.lastCheck.toISOString() }) 38 if (this.lastCheck) Object.assign(qs, { since: this.lastCheck.toISOString() })
41 39
42 this.lastCheck = new Date() 40 this.lastCheck = new Date()
43 41
44 const { body } = await doRequest<any>({ uri, qs, json: true }) 42 const { body } = await doRequest<any>({ uri: indexUrl, qs, json: true })
45 if (!body.data || Array.isArray(body.data) === false) { 43 if (!body.data || Array.isArray(body.data) === false) {
46 logger.error('Cannot auto follow instances of index %s: bad URL format. Please check the auto follow URL.', indexUrl) 44 logger.error('Cannot auto follow instances of index %s. Please check the auto follow URL.', indexUrl, { body })
47 return 45 return
48 } 46 }
49 47