summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2017-08-25 17:06:00 +0200
committerschneefux <schneefux+commit@schneefux.xyz>2017-08-25 17:06:00 +0200
commit7cbbadb86aeadea192f4b75d398b1f3e9d731e48 (patch)
tree03123bea52f597225deb8538029a142587abf145
parent4d86b511a12ba1863fb32354c1c69ac05216c406 (diff)
downloadorm-7cbbadb86aeadea192f4b75d398b1f3e9d731e48.tar.gz
orm-7cbbadb86aeadea192f4b75d398b1f3e9d731e48.zip
add custom http request timeout
-rw-r--r--api.js2
1 files changed, 2 insertions, 0 deletions
diff --git a/api.js b/api.js
index 8d14a6b..58a51d7 100644
--- a/api.js
+++ b/api.js
@@ -9,6 +9,7 @@ const Promise = require("bluebird"),
const MADGLORY_TOKEN = process.env.MADGLORY_TOKEN,
MADGLORY_URL = process.env.MADGLORY_URL || "https://api.dc01.gamelockerapp.com",
+ API_TIMEOUT = process.env.API_TIMEOUT || 20, // seconds
ERROR_LOG = process.env.ERROR_LOG || "./errors.json";
if (MADGLORY_TOKEN == undefined) throw "Need an API token";
@@ -31,6 +32,7 @@ module.exports.request = async (url, options, logger) => {
gzip: true,
time: true,
forever: true,
+ timeout: API_TIMEOUT*1000,
strictSSL: true,
resolveWithFullResponse: true
};