@nexrender/core 1.60.9 → 1.60.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexrender/core",
3
- "version": "1.60.9",
3
+ "version": "1.60.10",
4
4
  "main": "src/index.js",
5
5
  "author": "Inlife",
6
6
  "homepage": "https://www.nexrender.com",
@@ -43,5 +43,5 @@
43
43
  "publishConfig": {
44
44
  "access": "public"
45
45
  },
46
- "gitHead": "5be66801935697f079768197e8e3ec2214316653"
46
+ "gitHead": "248afa43b4467ef3ae61bdbe74392d159e41f386"
47
47
  }
@@ -9,7 +9,7 @@ const mime = require('mime-types')
9
9
  const {expandEnvironmentVariables} = require('../helpers/path')
10
10
  const { withTimeout } = require('../helpers/timeout');
11
11
 
12
- const NEXRENDER_DOWNLOAD_TIMEOUT = process.env.NEXRENDER_DOWNLOAD_TIMEOUT || 3 * 60 * 1000; // 3 minutes timeout by default
12
+ const NEXRENDER_DOWNLOAD_TIMEOUT = Number(process.env.NEXRENDER_DOWNLOAD_TIMEOUT) || 3 * 60 * 1000; // 3 minutes timeout by default
13
13
 
14
14
  const download = (job, settings, asset) => {
15
15
  if (asset.type == 'data') return Promise.resolve();
@@ -90,7 +90,11 @@ const download = (job, settings, asset) => {
90
90
 
91
91
  /* TODO: maybe move to external package ?? */
92
92
  const src = asset.src
93
- return fetch(src, asset.params)
93
+ return withTimeout(
94
+ fetch(src, {
95
+ ...asset.params,
96
+ timeout: NEXRENDER_DOWNLOAD_TIMEOUT
97
+ })
94
98
  .then(res => res.ok ? res : Promise.reject(new Error(`Unable to download file ${src}`)))
95
99
  .then(res => {
96
100
  // Set a file extension based on content-type header if not already set
@@ -122,7 +126,7 @@ const download = (job, settings, asset) => {
122
126
  .on('error', errorHandler)
123
127
  .on('finish', resolve)
124
128
  }), NEXRENDER_DOWNLOAD_TIMEOUT, 'Download timed out for asset ' + asset.src)
125
- });
129
+ }), NEXRENDER_DOWNLOAD_TIMEOUT, 'Download timed out for asset ' + asset.src)
126
130
 
127
131
  case 'file':
128
132
  const filepath = uri2path(expandEnvironmentVariables(asset.src))