made the timeout a config value

This commit is contained in:
bill bittner 2018-06-29 08:31:47 -07:00
parent bd67fdf974
commit 778d75931d

View file

@ -1,6 +1,6 @@
const axios = require('axios'); const axios = require('axios');
const logger = require('winston'); const logger = require('winston');
const { apiHost, apiPort } = require('@config/lbryConfig'); const { apiHost, apiPort, getTimeout } = require('@config/lbryConfig');
const lbrynetUri = 'http://' + apiHost + ':' + apiPort; const lbrynetUri = 'http://' + apiHost + ':' + apiPort;
const { chooseGaLbrynetPublishLabel, sendGATimingEvent } = require('../utils/googleAnalytics.js'); const { chooseGaLbrynetPublishLabel, sendGATimingEvent } = require('../utils/googleAnalytics.js');
const handleLbrynetResponse = require('./utils/handleLbrynetResponse.js'); const handleLbrynetResponse = require('./utils/handleLbrynetResponse.js');
@ -31,7 +31,10 @@ module.exports = {
axios axios
.post(lbrynetUri, { .post(lbrynetUri, {
method: 'get', method: 'get',
params: { uri, timeout: 30 }, params: {
uri,
timeout: getTimeout || 30,
},
}) })
.then(response => { .then(response => {
sendGATimingEvent('lbrynet', 'getClaim', 'GET', gaStartTime, Date.now()); sendGATimingEvent('lbrynet', 'getClaim', 'GET', gaStartTime, Date.now());