Skip to content

Commit 206d763

Browse files
committed
Bypass cache for some links, add diagnostic logging
1 parent ac6f67c commit 206d763

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

plugins/github-enricher/gatsby-node.js

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -693,10 +693,18 @@ const getMetadataPathNoCache = async (coords, groupId, artifactId) => {
693693

694694
const getIssueInformation = async (coords, labels, scmUrl) => {
695695
const key = labels ? labels.map(label => `"${label}"`).join() : `${coords.owner}-${coords.name}`
696-
return await issueCountCache.getOrSet(
697-
key,
698-
() => getIssueInformationNoCache(coords, labels, scmUrl)
699-
)
696+
697+
// Diagnostic - bypass the cache
698+
if (coords?.name?.includes("debezium") || coords?.name?.includes("optaplanner")) {
699+
console.log("Bypassing issue url cache for", coords.name)
700+
return getIssueInformationNoCache(coords, labels, scmUrl)
701+
} else {
702+
703+
return await issueCountCache.getOrSet(
704+
key,
705+
() => getIssueInformationNoCache(coords, labels, scmUrl)
706+
)
707+
}
700708
}
701709

702710
function normaliseUrl(issuesUrl) {
@@ -764,6 +772,8 @@ const maybeIssuesUrl = async (issues, issuesUrl) => {
764772
default: urlExist,
765773
} = await import("url-exist")
766774

775+
console.log("Validating issue url for", issuesUrl, "because issues is", issues)
776+
767777
const isValidUrl = await urlExist(issuesUrl)
768778

769779
let isOriginalUrl = isValidUrl && await isNotRedirectToPulls(issuesUrl)
@@ -775,7 +785,10 @@ const maybeIssuesUrl = async (issues, issuesUrl) => {
775785
const isNotRedirectToPulls = async (issuesUrl) => {
776786
// Being a valid url may not be enough, we also want to check for redirects to /pulls
777787
const urls = await followRedirect.startFollowing(issuesUrl)
788+
console.log("URL chain for", issuesUrl, "is", urls)
778789
const finalUrl = urls[urls.length - 1]
790+
console.log("Final URL is", finalUrl, "which means", !(finalUrl.url.includes("/pulls")))
791+
779792
return !(finalUrl.url.includes("/pulls"))
780793
}
781794

0 commit comments

Comments
 (0)