jshint happy

This commit is contained in:
Simon Martín 2018-05-25 18:50:56 +02:00
parent 22caa049ee
commit 3cf28bb7ff
4 changed files with 11 additions and 12 deletions

View File

@ -71,7 +71,7 @@ function handleCopyTo (logger) {
req.query.q,
res.locals.userDbParams,
logger,
function(err, metrics) {
function(err) {
if (err) {
return next(err);
}
@ -91,13 +91,13 @@ function handleCopyFrom (logger) {
res.locals.userDbParams,
req.get('content-encoding') === 'gzip',
logger,
function(err, response) { // TODO: remove when data-ingestion log works: {time, rows}
function(err, metrics) { // TODO: remove when data-ingestion log works: {time, rows}
if (err) {
return next(err);
}
// TODO: remove when data-ingestion log works
const { time, rows, type, format, gzip, size } = response;
const { time, rows, type, format, gzip, size } = metrics;
if (!time || !rows) {
return next(new Error("No rows copied"));
@ -114,7 +114,7 @@ function handleCopyFrom (logger) {
total_rows: rows
});
}
)
);
};
}

View File

@ -6,7 +6,7 @@ const StreamCopyMetrics = require('./stream_copy_metrics');
module.exports = {
to (res, sql, userDbParams, logger, cb) {
let metrics = new StreamCopyMetrics(logger, 'copyto', sql)
let metrics = new StreamCopyMetrics(logger, 'copyto', sql);
const pg = new PSQL(userDbParams);
pg.connect(function (err, client) {
@ -31,7 +31,7 @@ module.exports = {
},
from (req, sql, userDbParams, gzip, logger, cb) {
let metrics = new StreamCopyMetrics(logger, 'copyfrom', sql, gzip)
let metrics = new StreamCopyMetrics(logger, 'copyfrom', sql, gzip);
const pg = new PSQL(userDbParams);
pg.connect(function (err, client) {
@ -75,5 +75,4 @@ module.exports = {
.pipe(pgstream);
});
}
}
};

View File

@ -11,8 +11,8 @@ module.exports = class StreamCopyMetrics {
this.rows = 0;
this.startTime = Date.now();
this.endTime;
this.time;
this.endTime = null;
this.time = null;
}
addSize (size) {
@ -33,4 +33,4 @@ module.exports = class StreamCopyMetrics {
time: this.time
});
}
}
};

View File

@ -17,7 +17,7 @@ const statsClient = StatsClient.getInstance(global.settings.statsd);
const server = require('../../app/server')(statsClient);
describe.only('copy-endpoints', function() {
describe('copy-endpoints', function() {
it('should work with copyfrom endpoint', function(done){
assert.response(server, {
url: "/api/v1/sql/copyfrom?" + querystring.stringify({