Skip to content

Commit

Permalink
Retry introspection query if it fails (#1490)
Browse files Browse the repository at this point in the history
  • Loading branch information
markgrahamdawson authored Oct 10, 2023
1 parent 1cb0078 commit 2549d65
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/services/workflow.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,18 @@ class WorkflowService {
async loadTypes () {
// TODO: this assumes all workflows use the same schema which is and
// isn't necessarily true, not quite sure, come back to this later.
const response = await this.apolloClient.query({
query: getIntrospectionQuery(),
fetchPolicy: 'no-cache'
})
let response
try {
response = await this.apolloClient.query({
query: getIntrospectionQuery(),
fetchPolicy: 'no-cache'
})
} catch (err) {
console.error(err)
console.log('retrying introspection query')
await new Promise(resolve => setTimeout(resolve, 2000))
return this.loadTypes()
}
const mutations = response.data.__schema.mutationType.fields
const queries = response.data.__schema.queryType.fields
const { types } = response.data.__schema
Expand Down

0 comments on commit 2549d65

Please sign in to comment.