diff --git a/lib/hdcontroller.js b/lib/hdcontroller.js index db10f3a..e28cf6b 100644 --- a/lib/hdcontroller.js +++ b/lib/hdcontroller.js @@ -189,7 +189,7 @@ class HDProxydClient { ._failover(method, stream, size, key, counter, log, callback, params); } receivedResponse = true; - log.debug('request received response'); + log.end('request received response'); return callback(err, ret); }, args, payload); } @@ -198,7 +198,7 @@ class HDProxydClient { * creation and its sending. */ _handleRequest(method, stream, size, key, log, callback, params, payload) { - //tslint:disable-next-line:no-any + // tslint:disable-next-line:no-any const headers = (params.headers ? params.headers : {}); const req = this._createRequestHeader(method, headers, key, params, log); const host = this.getCurrentBootstrap(); @@ -374,7 +374,7 @@ class HDProxydClient { hostname: currentBootstrap[0], port: currentBootstrap[1], method: 'GET', - path: '/metrics', // XXX + path: '/metrics', headers: { 'X-Scal-Request-Uids': logger.getSerializedUids(), }, diff --git a/lib/shuffle.js b/lib/shuffle.js index 4e6db36..b7d9856 100644 --- a/lib/shuffle.js +++ b/lib/shuffle.js @@ -23,12 +23,7 @@ function nextBytes(numBytes) { return randomBytes(numBytes); } catch (ex) { - if (ex instanceof Error) { - throw new Error(`Insufficient entropy: ${ex.message}`); - } - else { - throw new Error('Insufficient entropy: Unknown error'); - } + throw new Error(`Insufficient entropy: ${ex instanceof Error ? ex.message : "Unknown error"}`); } } /* diff --git a/package.json b/package.json index f589fb4..99b4ca2 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "build": "tsc --strict ", "coverage": "nyc --check-coverage --exclude 'tests/*' --lines=90 --reporter=text --reporter=html --reporter=lcov npm test tests/", "jsdoc": "jsdoc src/ tests/ -d docs/jsdoc", - "lint": "eslint $(git ls-files '*.ts')", + "lint": "eslint $(git ls-files '*.ts' '*.js')", "test": "mocha --require ts-node/register --use_strict --check-leaks --recursive tests/**/*.ts", "get-version": "echo $npm_package_version" }, diff --git a/src/hdcontroller.ts b/src/hdcontroller.ts index 4cad761..9a99611 100644 --- a/src/hdcontroller.ts +++ b/src/hdcontroller.ts @@ -1,4 +1,4 @@ -'use strict'; +'use strict'; import * as assert from 'assert'; import * as async from 'async'; @@ -186,9 +186,7 @@ export class HDProxydClient { reqHeaders['X-Scal-Request-Uids'] = reqUids; reqHeaders['X-Scal-Trace-Ids'] = reqUids; if (params && params.range) { - reqHeaders.Range = `bytes=${params.range[0]}-${params.range[1]}`; - } let realPath: string; if (key === '/job/delete') { @@ -237,7 +235,7 @@ export class HDProxydClient { callback, params); } receivedResponse = true; - log.debug('request received response'); + log.end('request received response'); return callback(err, ret); }, args, payload); } @@ -250,7 +248,7 @@ export class HDProxydClient { size: number, key: string, log: werelogs.RequestLogger, callback: HDProxydCallback, params: Params, payload: object | undefined): void { - //tslint:disable-next-line:no-any + // tslint:disable-next-line:no-any const headers = ( params.headers ? params.headers : {}) as { 'content-length'?: number; [key: string]: any }; const req = this._createRequestHeader(method, headers, key, params, log); @@ -430,7 +428,7 @@ export class HDProxydClient { hostname: currentBootstrap[0], port: currentBootstrap[1], method: 'GET', - path: '/metrics', // XXX + path: '/metrics', headers: { 'X-Scal-Request-Uids': logger.getSerializedUids(), }, diff --git a/src/shuffle.ts b/src/shuffle.ts index f16d450..e7ace79 100644 --- a/src/shuffle.ts +++ b/src/shuffle.ts @@ -24,11 +24,7 @@ function nextBytes(numBytes: number): Buffer { try { return randomBytes(numBytes); } catch (ex) { - if (ex instanceof Error) { - throw new Error(`Insufficient entropy: ${ex.message}`); - } else { - throw new Error('Insufficient entropy: Unknown error'); - } + throw new Error(`Insufficient entropy: ${ex instanceof Error ? ex.message : "Unknown error"}`); } }