X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=server%2Flib%2Fschedulers%2Fauto-follow-index-instances.ts;h=956ece749b8d54d87af690b0dbce53bd15046035;hb=57c318653e6a8ae9d0c2541a62853fb8dd582d5d;hp=f62f52f9cdc237adf6dcea7b34bd3644ae4be30f;hpb=2ca154da93acb7b87a12f6a9477d90cfb2a10475;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/schedulers/auto-follow-index-instances.ts b/server/lib/schedulers/auto-follow-index-instances.ts index f62f52f9c..956ece749 100644 --- a/server/lib/schedulers/auto-follow-index-instances.ts +++ b/server/lib/schedulers/auto-follow-index-instances.ts @@ -1,7 +1,7 @@ import { chunk } from 'lodash' -import { doRequest } from '@server/helpers/requests' +import { doJSONRequest } from '@server/helpers/requests' import { JobQueue } from '@server/lib/job-queue' -import { ActorFollowModel } from '@server/models/activitypub/actor-follow' +import { ActorFollowModel } from '@server/models/actor/actor-follow' import { getServerActor } from '@server/models/application/application' import { logger } from '../../helpers/logger' import { CONFIG } from '../../initializers/config' @@ -12,7 +12,7 @@ export class AutoFollowIndexInstances extends AbstractScheduler { private static instance: AbstractScheduler - protected schedulerIntervalMs = SCHEDULER_INTERVALS_MS.autoFollowIndexInstances + protected schedulerIntervalMs = SCHEDULER_INTERVALS_MS.AUTO_FOLLOW_INDEX_INSTANCES private lastCheck: Date @@ -34,12 +34,12 @@ export class AutoFollowIndexInstances extends AbstractScheduler { try { const serverActor = await getServerActor() - const qs = { count: 1000 } - if (this.lastCheck) Object.assign(qs, { since: this.lastCheck.toISOString() }) + const searchParams = { count: 1000 } + if (this.lastCheck) Object.assign(searchParams, { since: this.lastCheck.toISOString() }) this.lastCheck = new Date() - const { body } = await doRequest({ uri: indexUrl, qs, json: true }) + const { body } = await doJSONRequest(indexUrl, { searchParams }) if (!body.data || Array.isArray(body.data) === false) { logger.error('Cannot auto follow instances of index %s. Please check the auto follow URL.', indexUrl, { body }) return @@ -59,7 +59,7 @@ export class AutoFollowIndexInstances extends AbstractScheduler { isAutoFollow: true } - JobQueue.Instance.createJob({ type: 'activitypub-follow', payload }) + JobQueue.Instance.createJobAsync({ type: 'activitypub-follow', payload }) } }