Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[hotfix-1.74] Do not fail if tickets could not be fetched #1905

Merged
merged 1 commit into from
Jun 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 29 additions & 12 deletions frontend/src/store/shoot/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,31 +321,48 @@ export const useShootStore = defineStore('shoot', () => {

const fetchShoot = async options => {
const [
{ data: shoot },
{ data: { issues = [], comments = [] } },
] = await Promise.all([
{ value: shootResult, reason: shootError },
{ value: issuesAndCommentsResult, reason: issuesAndCommentsError },
] = await Promise.allSettled([
api.getShoot(options),
api.getIssuesAndComments(options),
])
if (shootError) {
throw shootError
}
logger.debug('Fetched shoot for %s in namespace %s', options.name, options.namespace)
if (issuesAndCommentsError) {
logger.warn('Tickets could not be fetched:', issuesAndCommentsError.message)
}
const {
issues = [],
comments = [],
} = issuesAndCommentsResult?.data ?? {}
// fetch shootInfo in the background (do not await the promise)
shootStore.fetchInfo(shoot.metadata)
logger.debug('Fetched shoot and tickets for %s in namespace %s', options.name, options.namespace)
return { shoots: [shoot], issues, comments }
shootStore.fetchInfo(shootResult.data.metadata)
return { shoots: [shootResult.data], issues, comments }
}

const fetchShoots = async options => {
const { namespace } = options
const [
{ data: { items } },
{ data: { issues = [] } },
] = await Promise.all([
{ value: shootsResult, reason: shootsError },
{ value: issuesResult, reason: issuesError },
] = await Promise.allSettled([
api.getShoots(options),
api.getIssues({ namespace }),
])
logger.debug('Fetched shoots and tickets in namespace %s', options.namespace)
return { shoots: items, issues, comments: [] }
if (shootsError) {
throw shootsError
}
logger.debug('Fetched shoots in namespace %s', options.namespace)
if (issuesError) {
logger.warn('Error fetching issues:', issuesError.message)
}
const { items: shoots } = shootsResult?.data ?? {}
const { issues = [] } = issuesResult?.data ?? {}
return { shoots, issues, comments: [] }
}

const getThrottleDelay = (options, n) => {
if (options.name) {
return 0
Expand Down