Merge pull request #13670 from Budibase/fix/13660
Fixing `AUTOMATION_THREAD_TIMEOUT` environment variable
This commit is contained in:
commit
dd5a4bdbe3
|
@ -166,10 +166,16 @@ const automationActions = store => ({
|
|||
await store.actions.save(newAutomation)
|
||||
},
|
||||
test: async (automation, testData) => {
|
||||
const result = await API.testAutomation({
|
||||
let result
|
||||
try {
|
||||
result = await API.testAutomation({
|
||||
automationId: automation?._id,
|
||||
testData,
|
||||
})
|
||||
} catch (err) {
|
||||
const message = err.message || err.status || JSON.stringify(err)
|
||||
throw `Automation test failed - ${message}`
|
||||
}
|
||||
if (!result?.trigger && !result?.steps?.length) {
|
||||
if (result?.err?.code === "usage_limit_exceeded") {
|
||||
throw "You have exceeded your automation quota"
|
||||
|
|
|
@ -279,8 +279,7 @@ export async function trigger(ctx: UserCtx) {
|
|||
{
|
||||
fields: ctx.request.body.fields,
|
||||
timeout:
|
||||
ctx.request.body.timeout * 1000 ||
|
||||
env.getDefaults().AUTOMATION_SYNC_TIMEOUT,
|
||||
ctx.request.body.timeout * 1000 || env.AUTOMATION_THREAD_TIMEOUT,
|
||||
},
|
||||
{ getResponses: true }
|
||||
)
|
||||
|
|
|
@ -20,7 +20,7 @@ function parseIntSafe(number?: string) {
|
|||
|
||||
const DEFAULTS = {
|
||||
QUERY_THREAD_TIMEOUT: 15000,
|
||||
AUTOMATION_THREAD_TIMEOUT: 12000,
|
||||
AUTOMATION_THREAD_TIMEOUT: 15000,
|
||||
AUTOMATION_SYNC_TIMEOUT: 120000,
|
||||
AUTOMATION_MAX_ITERATIONS: 200,
|
||||
JS_PER_EXECUTION_TIME_LIMIT_MS: 1500,
|
||||
|
@ -34,6 +34,10 @@ const DEFAULTS = {
|
|||
const QUERY_THREAD_TIMEOUT =
|
||||
parseIntSafe(process.env.QUERY_THREAD_TIMEOUT) ||
|
||||
DEFAULTS.QUERY_THREAD_TIMEOUT
|
||||
const DEFAULT_AUTOMATION_TIMEOUT =
|
||||
QUERY_THREAD_TIMEOUT > DEFAULTS.AUTOMATION_THREAD_TIMEOUT
|
||||
? QUERY_THREAD_TIMEOUT
|
||||
: DEFAULTS.AUTOMATION_THREAD_TIMEOUT
|
||||
const environment = {
|
||||
// features
|
||||
APP_FEATURES: process.env.APP_FEATURES,
|
||||
|
@ -75,9 +79,7 @@ const environment = {
|
|||
QUERY_THREAD_TIMEOUT: QUERY_THREAD_TIMEOUT,
|
||||
AUTOMATION_THREAD_TIMEOUT:
|
||||
parseIntSafe(process.env.AUTOMATION_THREAD_TIMEOUT) ||
|
||||
DEFAULTS.AUTOMATION_THREAD_TIMEOUT > QUERY_THREAD_TIMEOUT
|
||||
? DEFAULTS.AUTOMATION_THREAD_TIMEOUT
|
||||
: QUERY_THREAD_TIMEOUT,
|
||||
DEFAULT_AUTOMATION_TIMEOUT,
|
||||
BB_ADMIN_USER_EMAIL: process.env.BB_ADMIN_USER_EMAIL,
|
||||
BB_ADMIN_USER_PASSWORD: process.env.BB_ADMIN_USER_PASSWORD,
|
||||
PLUGINS_DIR: process.env.PLUGINS_DIR || DEFAULTS.PLUGINS_DIR,
|
||||
|
|
Loading…
Reference in New Issue