Skip to content

Commit 9e58dfb

Browse files
authored
Merge pull request #138 from holas1337/add-payload-timeout
added payload timeout
2 parents 9503b62 + 8546247 commit 9e58dfb

File tree

5 files changed

+7
-1
lines changed

5 files changed

+7
-1
lines changed

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ RUN npm install --production
1414
# Env variables
1515
ENV SERVER_PORT 3000
1616
ENV PAYLOAD_MAX_SIZE 1048576
17+
ENV PAYLOAD_TIMEOUT 120000
1718
ENV TIMEOUT_SERVER 120000
1819
ENV TIMEOUT_SOCKET 140000
1920

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ SERVER_PORT default is 3000
6161

6262
PAYLOAD_MAX_SIZE default is 1048576 (1 MB)
6363

64+
PAYLOAD_TIMEOUT default is 2 minutes (120 000 milliseconds)
65+
6466
TIMEOUT_SERVER default is 2 minutes (120 000 milliseconds)
6567

6668
TIMEOUT_SOCKET default is 2 minutes and 20 seconds (140 000 milliseconds)

config/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
module.exports = {
44
SERVER_PORT: process.env.SERVER_PORT || 3000,
55
PAYLOAD_MAX_SIZE: process.env.PAYLOAD_MAX_SIZE || 1048576,
6+
PAYLOAD_TIMEOUT: process.env.PAYLOAD_TIMEOUT || 60000 * 2,
67
TIMEOUT_SERVER: process.env.TIMEOUT_SERVER || 60000 * 2,
78
TIMEOUT_SOCKET: process.env.TIMEOUT_SOCKET || 70000 * 2
89
}

docker.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
SERVER_PORT=3000
22
PAYLOAD_MAX_SIZE=1048576
3+
PAYLOAD_TIMEOUT=120000
34
TIMEOUT_SERVER=120000
45
TIMEOUT_SOCKET=140000

routes/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ module.exports = [
1212
output: 'stream',
1313
parse: true,
1414
allow: 'multipart/form-data',
15-
maxBytes: parseInt(config.PAYLOAD_MAX_SIZE, 10)
15+
maxBytes: parseInt(config.PAYLOAD_MAX_SIZE, 10),
16+
timeout: parseInt(config.PAYLOAD_TIMEOUT, 10)
1617
},
1718
timeout: {
1819
server: parseInt(config.TIMEOUT_SERVER, 10),

0 commit comments

Comments
 (0)