mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-25 11:31:38 -08:00
Add configurable HTTP timeout for N8N requests
This commit is contained in:
parent
3a5bd12945
commit
c6bff40cd6
|
@ -60,6 +60,12 @@ export const schema = {
|
|||
default: 3600,
|
||||
env: 'EXECUTIONS_TIMEOUT_MAX',
|
||||
},
|
||||
httpTimeout: {
|
||||
doc: 'Timeout for HTTP requests (seconds)',
|
||||
format: Number,
|
||||
default: 300,
|
||||
env: 'N8N_HTTP_TIMEOUT',
|
||||
},
|
||||
|
||||
// If a workflow executes all the data gets saved by default. This
|
||||
// could be a problem when a workflow gets executed a lot and processes
|
||||
|
|
|
@ -12,3 +12,4 @@ export const CONFIG_FILES = 'N8N_CONFIG_FILES';
|
|||
export const BINARY_DATA_STORAGE_PATH = 'N8N_BINARY_DATA_STORAGE_PATH';
|
||||
export const UM_EMAIL_TEMPLATES_INVITE = 'N8N_UM_EMAIL_TEMPLATES_INVITE';
|
||||
export const UM_EMAIL_TEMPLATES_PWRESET = 'N8N_UM_EMAIL_TEMPLATES_PWRESET';
|
||||
export const HTTP_TIMEOUT = 'N8N_HTTP_TIMEOUT';
|
||||
|
|
|
@ -119,6 +119,7 @@ import {
|
|||
BLOCK_FILE_ACCESS_TO_N8N_FILES,
|
||||
CONFIG_FILES,
|
||||
CUSTOM_EXTENSION_ENV,
|
||||
HTTP_TIMEOUT,
|
||||
RESTRICT_FILE_ACCESS_TO,
|
||||
UM_EMAIL_TEMPLATES_INVITE,
|
||||
UM_EMAIL_TEMPLATES_PWRESET,
|
||||
|
@ -140,7 +141,11 @@ import {
|
|||
import { ScheduledTaskManager } from './ScheduledTaskManager';
|
||||
import { SSHClientsManager } from './SSHClientsManager';
|
||||
|
||||
axios.defaults.timeout = 300000;
|
||||
// httpTimeout schema config is provided in seconds
|
||||
axios.defaults.timeout = process.env[HTTP_TIMEOUT]
|
||||
? parseInt(process.env[HTTP_TIMEOUT]) * 1000
|
||||
: 300000;
|
||||
|
||||
// Prevent axios from adding x-form-www-urlencoded headers by default
|
||||
axios.defaults.headers.post = {};
|
||||
axios.defaults.headers.put = {};
|
||||
|
|
Loading…
Reference in a new issue