diff --git a/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/rest/[query]/index.svelte b/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/rest/[query]/index.svelte index 17e35eda31..e870c2f6db 100644 --- a/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/rest/[query]/index.svelte +++ b/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/rest/[query]/index.svelte @@ -136,7 +136,7 @@ notifications.success("Request sent successfully") } } catch (error) { - notifications.error("Error running query") + notifications.error(`Query Error: ${error.message}`) } } diff --git a/packages/server/src/threads/index.js b/packages/server/src/threads/index.js index 94571c31d1..b41acabb4c 100644 --- a/packages/server/src/threads/index.js +++ b/packages/server/src/threads/index.js @@ -36,6 +36,7 @@ class Thread { maxConcurrentWorkers: this.count, } if (opts.timeoutMs) { + this.timeoutMs = opts.timeoutMs workerOpts.maxCallTime = opts.timeoutMs } this.workers = workerFarm(workerOpts, typeToFile(type)) @@ -43,6 +44,7 @@ class Thread { } run(data) { + const timeoutMs = this.timeoutMs return new Promise((resolve, reject) => { let fncToCall // if in test then don't use threading @@ -52,7 +54,11 @@ class Thread { fncToCall = this.workers } fncToCall(data, (err, response) => { - if (err) { + if (err && err.type === "TimeoutError") { + reject( + new Error(`Query response time exceeded ${timeoutMs}ms timeout.`) + ) + } else if (err) { reject(err) } else { resolve(response)