From 0f1d946c90bea6da149c6ed897c0e0b39aa927fd Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Thu, 5 Jul 2018 09:52:31 +0200 Subject: [PATCH] fix: delete issueList after creating issue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Delete cached issueList after creating any new issue, so that we don’t end up with “old†state and potentially create duplicate issues. --- lib/platform/github/index.js | 5 ++++- lib/platform/gitlab/index.js | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/platform/github/index.js b/lib/platform/github/index.js index e1b12ac81d..3cfc485241 100644 --- a/lib/platform/github/index.js +++ b/lib/platform/github/index.js @@ -589,7 +589,8 @@ async function getIssueList() { if (!config.issueList) { const res = await get( `repos/${config.parentRepo || - config.repository}/issues?filter=created&state=open` + config.repository}/issues?filter=created&state=open`, + { useCache: false } ); // istanbul ignore if if (!is.array(res.body)) { @@ -632,6 +633,8 @@ async function ensureIssue(title, body) { body, }, }); + // reset issueList so that it will be fetched again as-needed + delete config.issueList; return 'created'; } } catch (err) /* istanbul ignore next */ { diff --git a/lib/platform/gitlab/index.js b/lib/platform/gitlab/index.js index 9811dcab30..b5ac0303b8 100644 --- a/lib/platform/gitlab/index.js +++ b/lib/platform/gitlab/index.js @@ -386,7 +386,9 @@ async function getBranchLastCommitTime(branchName) { async function getIssueList() { if (!config.issueList) { - const res = await get(`projects/${config.repository}/issues?state=opened`); + const res = await get(`projects/${config.repository}/issues?state=opened`, { + useCache: false, + }); // istanbul ignore if if (!is.array(res.body)) { logger.warn({ responseBody: res.body }, 'Could not retrieve issue list'); @@ -423,6 +425,8 @@ async function ensureIssue(title, body) { description: body, }, }); + // delete issueList so that it will be refetched as necessary + delete config.issueList; return 'created'; } } catch (err) /* istanbul ignore next */ { -- GitLab