mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 23:16:26 +00:00
refactor(github): improve graphql logging and retries
This commit is contained in:
parent
c56362f63b
commit
227d1d4cb7
2 changed files with 12 additions and 2 deletions
|
@ -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 (
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue