Some quick fixes, making sure that automation queries respect timeout, they will timeout within the usual range.
This commit is contained in:
parent
43671f1aa3
commit
169fec29c6
|
@ -226,8 +226,19 @@ export function isClient(ctx: Ctx) {
|
|||
return ctx.headers[Header.TYPE] === "client"
|
||||
}
|
||||
|
||||
export function timeout(timeMs: number) {
|
||||
return new Promise(resolve => setTimeout(resolve, timeMs))
|
||||
export function timeout(
|
||||
timeMs: number,
|
||||
opts?: { reject?: boolean }
|
||||
): Promise<void> {
|
||||
return new Promise((resolve, reject) => {
|
||||
setTimeout(() => {
|
||||
if (opts?.reject) {
|
||||
reject(new Error(`timed out - ${timeMs}ms`))
|
||||
} else {
|
||||
resolve()
|
||||
}
|
||||
}, timeMs)
|
||||
})
|
||||
}
|
||||
|
||||
export function isAudited(event: Event) {
|
||||
|
|
|
@ -159,7 +159,7 @@
|
|||
newQuery.fields.queryString = queryString
|
||||
newQuery.fields.authConfigId = authConfigId
|
||||
newQuery.fields.disabledHeaders = restUtils.flipHeaderState(enabledHeaders)
|
||||
newQuery.schema = schema
|
||||
newQuery.schema = schema || {}
|
||||
|
||||
return newQuery
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ const PATH_PREFIX = "/bulladmin"
|
|||
|
||||
export async function init() {
|
||||
// Set up queues for bull board admin
|
||||
const backupQueue = await backups.getBackupQueue()
|
||||
const backupQueue = backups.getBackupQueue()
|
||||
const queues = [automationQueue]
|
||||
if (backupQueue) {
|
||||
queues.push(backupQueue)
|
||||
|
|
|
@ -10,6 +10,8 @@ import {
|
|||
AutomationStepSchema,
|
||||
AutomationStepType,
|
||||
} from "@budibase/types"
|
||||
import { utils } from "@budibase/backend-core"
|
||||
import env from "../../environment"
|
||||
|
||||
export const definition: AutomationStepSchema = {
|
||||
name: "External Data Connector",
|
||||
|
@ -84,7 +86,10 @@ export async function run({ inputs, appId, emitter }: AutomationStepInput) {
|
|||
})
|
||||
|
||||
try {
|
||||
await queryController.executeV2(ctx, { isAutomation: true })
|
||||
await Promise.race([
|
||||
queryController.executeV2(ctx, { isAutomation: true }),
|
||||
utils.timeout(env.QUERY_THREAD_TIMEOUT, { reject: true }),
|
||||
])
|
||||
const { data, ...rest } = ctx.body
|
||||
|
||||
return {
|
||||
|
|
Loading…
Reference in New Issue