X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Factivitypub%2Fcrawl.ts;h=336129b822013a0e3e01786069d6923005d1de27;hb=d4fff51d96925b5704c97dd673dd779030b1aced;hp=cd117f5712896e81ce374722723353a0e07ebbc8;hpb=cf21b2cbef61929177b9c09b5e017c3b7eb8535d;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/activitypub/crawl.ts b/server/lib/activitypub/crawl.ts index cd117f571..336129b82 100644 --- a/server/lib/activitypub/crawl.ts +++ b/server/lib/activitypub/crawl.ts @@ -1,12 +1,13 @@ -import * as Bluebird from 'bluebird' +import Bluebird from 'bluebird' import { URL } from 'url' +import { retryTransactionWrapper } from '@server/helpers/database-utils' import { ActivityPubOrderedCollection } from '../../../shared/models/activitypub' import { logger } from '../../helpers/logger' import { doJSONRequest } from '../../helpers/requests' import { ACTIVITY_PUB, WEBSERVER } from '../../initializers/constants' type HandlerFunction = (items: T[]) => (Promise | Bluebird) -type CleanerFunction = (startedDate: Date) => (Promise | Bluebird) +type CleanerFunction = (startedDate: Date) => Promise async function crawlCollectionPage (argUrl: string, handler: HandlerFunction, cleaner?: CleanerFunction) { let url = argUrl @@ -51,7 +52,7 @@ async function crawlCollectionPage (argUrl: string, handler: HandlerFunction } } - if (cleaner) await cleaner(startDate) + if (cleaner) await retryTransactionWrapper(cleaner, startDate) } export {