From 2549d65663fe9564f371e7805700eb9ec47295f1 Mon Sep 17 00:00:00 2001 From: Mark Dawson Date: Tue, 10 Oct 2023 13:35:49 +0100 Subject: [PATCH] Retry introspection query if it fails (#1490) --- src/services/workflow.service.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/services/workflow.service.js b/src/services/workflow.service.js index 6991d680d..2b07fa1c9 100644 --- a/src/services/workflow.service.js +++ b/src/services/workflow.service.js @@ -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