From 6c3db60d8eb308cd92d4416ba962eedd34e3fab0 Mon Sep 17 00:00:00 2001 From: schneefux Date: Mon, 21 Aug 2017 19:39:38 +0200 Subject: log TTFB --- api.js | 1 + 1 file changed, 1 insertion(+) (limited to 'api.js') diff --git a/api.js b/api.js index 1146f86..8d14a6b 100644 --- a/api.js +++ b/api.js @@ -69,6 +69,7 @@ module.exports.request = async (url, options, logger) => { qs: options, status: response.statusCode, connection_start: response.timings.connect, + connection_first: response.timings.response, connection_end: response.timings.end, ratelimit_remaining: parseInt(response.headers["x-ratelimit-remaining"]) }); -- cgit v1.3.1 From 2417386fd081a58dee26caf089bf707fbab47a66 Mon Sep 17 00:00:00 2001 From: schneefux Date: Fri, 25 Aug 2017 17:06:00 +0200 Subject: add custom http request timeout --- api.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'api.js') 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 }; -- cgit v1.3.1