diff --git a/lib/platform/github/gh-got-wrapper.js b/lib/platform/github/gh-got-wrapper.js index e3344e819a20416386ea9bbb4a5d46c4e4f3f9fa..3d09a0ccdfc8817c746c77236f067b40baeeb827 100644 --- a/lib/platform/github/gh-got-wrapper.js +++ b/lib/platform/github/gh-got-wrapper.js @@ -78,6 +78,16 @@ async function get(path, options, retries = 5) { ) { cache[path] = res; } + // istanbul ignore if + if (method === 'POST' && path === 'graphql') { + if (res.errors && retries > 0) { + logger.info('Retrying graphql query'); + return get(path, opts, 0); + } + if (res.data && retries === 0) { + logger.info('Recovered graphql query'); + } + } return res; } catch (err) { if ( diff --git a/lib/platform/github/index.js b/lib/platform/github/index.js index 2a55cca7af0f3cbdbf1e7e3b354b296ee26f0a24..13dedf2c0eca5990015b9635b628d23ef4cb0b13 100644 --- a/lib/platform/github/index.js +++ b/lib/platform/github/index.js @@ -893,7 +893,7 @@ async function getOpenPrs() { const prNumbers = []; // istanbul ignore if if (!res.data) { - logger.warn({ res }, 'No graphql res.data'); + logger.warn({ query, res }, 'No graphql res.data'); return {}; } for (const pr of res.data.repository.pullRequests.nodes) { @@ -995,7 +995,7 @@ async function getClosedPrs() { const prNumbers = []; // istanbul ignore if if (!res.data) { - logger.warn({ res }, 'No graphql res.data'); + logger.warn({ query, res }, 'No graphql res.data'); return {}; } for (const pr of res.data.repository.pullRequests.nodes) {