fix: "TypeError: fn is not a function" crash in release notes generator (#19394)

* fix: fix cache filename of issue comments

* fix: update octokit deprecated API use

* fix: "TypeError: fn is not a function" in notes.js

* chore: retryableFunc does not need to be async

* chore: simplify checkCache() operation param
This commit is contained in:
Charles Kerr 2019-07-24 12:23:40 -05:00 committed by John Kleinschmidt
parent a25b15bc2a
commit 898adbce5c

View file

@ -319,25 +319,14 @@ async function runRetryable (fn, maxRetries) {
const getPullRequest = async (number, owner, repo) => {
const name = `${owner}-${repo}-pull-${number}`
return checkCache(name, async () => {
return runRetryable(octokit.pulls.get({
number,
owner,
repo
}), MAX_FAIL_COUNT)
})
const retryableFunc = () => octokit.pulls.get({ pull_number: number, owner, repo })
return checkCache(name, () => runRetryable(retryableFunc, MAX_FAIL_COUNT))
}
const getComments = async (number, owner, repo) => {
const name = `${owner}-${repo}-pull-${number}-comments`
return checkCache(name, async () => {
return runRetryable(octokit.issues.listComments({
number,
owner,
repo,
per_page: 100
}), MAX_FAIL_COUNT)
})
const name = `${owner}-${repo}-issue-${number}-comments`
const retryableFunc = () => octokit.issues.listComments({ issue_number: number, owner, repo, per_page: 100 })
return checkCache(name, () => runRetryable(retryableFunc, MAX_FAIL_COUNT))
}
const addRepoToPool = async (pool, repo, from, to) => {