From d4709ec76182bcbbd08db6967afdbdaad37764ce Mon Sep 17 00:00:00 2001 From: Sergei Zharinov <zharinov@users.noreply.github.com> Date: Thu, 20 Oct 2022 19:53:45 +0300 Subject: [PATCH] fix(github): Shrink GraphQL pagination for `ExternalHostError` (#18435) --- lib/util/github/graphql/datasource-helper.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/util/github/graphql/datasource-helper.ts b/lib/util/github/graphql/datasource-helper.ts index a8d275efc2..0f94b1aa33 100644 --- a/lib/util/github/graphql/datasource-helper.ts +++ b/lib/util/github/graphql/datasource-helper.ts @@ -1,6 +1,6 @@ import AggregateError from 'aggregate-error'; -import { TimeoutError } from 'got'; import { logger } from '../../../logger'; +import { ExternalHostError } from '../../../types/errors/external-host-error'; import * as memCache from '../../cache/memory'; import type { GithubGraphqlResponse, @@ -30,13 +30,11 @@ function isUnknownGraphqlError(err: Error): boolean { return message.startsWith('Something went wrong while executing your query.'); } -function isTimeoutError(err: Error): err is TimeoutError { - return err instanceof TimeoutError; -} - function canBeSolvedByShrinking(err: Error): boolean { const errors: Error[] = err instanceof AggregateError ? [...err] : [err]; - return errors.some((e) => isTimeoutError(e) || isUnknownGraphqlError(e)); + return errors.some( + (e) => err instanceof ExternalHostError || isUnknownGraphqlError(e) + ); } export class GithubGraphqlDatasourceHelper< -- GitLab