diff options
author | Chocobozzz <me@florianbigard.com> | 2020-05-12 09:37:39 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-05-12 09:37:39 +0200 |
commit | 2ca154da93acb7b87a12f6a9477d90cfb2a10475 (patch) | |
tree | 5843af40eadb28c6ccbc8a9887c40f84ec8423c3 /server/lib/schedulers | |
parent | 5ca8c03e1dc172813d65397954ee785d462d83aa (diff) | |
download | PeerTube-2ca154da93acb7b87a12f6a9477d90cfb2a10475.tar.gz PeerTube-2ca154da93acb7b87a12f6a9477d90cfb2a10475.tar.zst PeerTube-2ca154da93acb7b87a12f6a9477d90cfb2a10475.zip |
Fix auto follow index URL
Diffstat (limited to 'server/lib/schedulers')
-rw-r--r-- | server/lib/schedulers/auto-follow-index-instances.ts | 16 |
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 @@ | |||
1 | import { logger } from '../../helpers/logger' | ||
2 | import { AbstractScheduler } from './abstract-scheduler' | ||
3 | import { INSTANCES_INDEX, SCHEDULER_INTERVALS_MS, SERVER_ACTOR_NAME } from '../../initializers/constants' | ||
4 | import { CONFIG } from '../../initializers/config' | ||
5 | import { chunk } from 'lodash' | 1 | import { chunk } from 'lodash' |
6 | import { doRequest } from '@server/helpers/requests' | 2 | import { doRequest } from '@server/helpers/requests' |
7 | import { ActorFollowModel } from '@server/models/activitypub/actor-follow' | ||
8 | import { JobQueue } from '@server/lib/job-queue' | 3 | import { JobQueue } from '@server/lib/job-queue' |
4 | import { ActorFollowModel } from '@server/models/activitypub/actor-follow' | ||
9 | import { getServerActor } from '@server/models/application/application' | 5 | import { getServerActor } from '@server/models/application/application' |
6 | import { logger } from '../../helpers/logger' | ||
7 | import { CONFIG } from '../../initializers/config' | ||
8 | import { SCHEDULER_INTERVALS_MS, SERVER_ACTOR_NAME } from '../../initializers/constants' | ||
9 | import { AbstractScheduler } from './abstract-scheduler' | ||
10 | 10 | ||
11 | export class AutoFollowIndexInstances extends AbstractScheduler { | 11 | export 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 | ||