From 49d3c18e31bed6a1716419beb17918834065117c Mon Sep 17 00:00:00 2001
From: Sergei Zharinov <zharinov@users.noreply.github.com>
Date: Tue, 16 Nov 2021 18:16:31 +0300
Subject: [PATCH] fix(github): Shrink GraphQL page size and retry for any
 ExternalHostError (#12689)

---
 lib/util/http/github.ts | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/lib/util/http/github.ts b/lib/util/http/github.ts
index 7674405713..c181dcb6f1 100644
--- a/lib/util/http/github.ts
+++ b/lib/util/http/github.ts
@@ -284,19 +284,9 @@ export class GithubHttp extends Http<GithubHttpOptions, GithubHttpOptions> {
       result = res?.body;
     } catch (err) {
       logger.debug({ err, query, options }, 'Unexpected GraphQL Error');
-      if (err instanceof ExternalHostError) {
-        const gotError = err.err as GotLegacyError;
-        const statusCode = gotError?.statusCode;
-        if (
-          count &&
-          count > 10 &&
-          statusCode &&
-          statusCode >= 500 &&
-          statusCode < 600
-        ) {
-          logger.info('Reducing pagination count to workaround graphql 5xx');
-          return null;
-        }
+      if (err instanceof ExternalHostError && count && count > 10) {
+        logger.info('Reducing pagination count to workaround graphql errors');
+        return null;
       }
       handleGotError(err, path, opts);
     }
-- 
GitLab