cleaned helper function location

This commit is contained in:
bill bittner 2018-01-23 12:47:10 -08:00
parent 76aadefc5e
commit e337025006
2 changed files with 12 additions and 14 deletions

View file

@ -112,7 +112,6 @@ module.exports = {
}, },
createChannel (name) { createChannel (name) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// make the request
axios axios
.post(lbryApiUrl, { .post(lbryApiUrl, {
method: 'channel_new', method: 'channel_new',

View file

@ -5,19 +5,18 @@ const config = require('../config/speechConfig.js');
const googleApiKey = config.analytics.googleId; const googleApiKey = config.analytics.googleId;
const db = require('../models'); const db = require('../models');
function createPublishTimingEventParams (publishDurration, ip, headers, label) {
return {
userTimingCategory : 'lbrynet',
userTimingVariableName: 'publish',
userTimingTime : publishDurration,
userTimingLabel : label,
uip : ip,
ua : headers['user-agent'],
ul : headers['accept-language'],
};
};
module.exports = { module.exports = {
createPublishTimingEventParams (publishDurration, ip, headers, label) {
return {
userTimingCategory : 'lbrynet',
userTimingVariableName: 'publish',
userTimingTime : publishDurration,
userTimingLabel : label,
uip : ip,
ua : headers['user-agent'],
ul : headers['accept-language'],
};
},
postToStats (action, url, ipAddress, name, claimId, result) { postToStats (action, url, ipAddress, name, claimId, result) {
logger.debug('action:', action); logger.debug('action:', action);
// make sure the result is a string // make sure the result is a string
@ -82,7 +81,7 @@ module.exports = {
case constants.PUBLISH_ANONYMOUS_CLAIM: case constants.PUBLISH_ANONYMOUS_CLAIM:
case constants.PUBLISH_IN_CHANNEL_CLAIM: case constants.PUBLISH_IN_CHANNEL_CLAIM:
logger.verbose(`${action} completed successfully in ${durration}ms`); logger.verbose(`${action} completed successfully in ${durration}ms`);
params = createPublishTimingEventParams(durration, ip, headers, action); params = module.exports.createPublishTimingEventParams(durration, ip, headers, action);
break; break;
default: break; default: break;
} }