Skip to content

Commit

Permalink
fix: reduce error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards1211 committed Jan 7, 2019
1 parent b64f29f commit 2850b83
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
"flow:watch": "flow-watch -e js,js.flow,flowconfig --ignore es/ --ignore node_modules/ --watch .flowconfig --watch src/ --watch test/",
"clean": "rimraf es lib $(cd src; ls) *.js.flow",
"build": "npm run clean && babel src --out-dir es && flow-copy-source -v src/ es && cross-env BABEL_ENV=es5 babel src --out-dir . && flow-copy-source -v src/ .",
"test": "cross-env NODE_ENV=production BABEL_ENV=es5 mocha $npm_package_config_mocha && cross-env NODE_ENV=production BABEL_ENV=coverage nyc --reporter=lcov --reporter=text mocha $npm_package_config_mocha",
"test:watch": "cross-env NODE_ENV=production BABEL_ENV=test mocha --watch $npm_package_config_mocha",
"test:debug": "cross-env NODE_ENV=production BABEL_ENV=test mocha --inspect-brk $npm_package_config_mocha",
"test": "defaultenv env/local.js cross-env NODE_ENV=production BABEL_ENV=es5 mocha $npm_package_config_mocha && defaultenv env/local.js cross-env NODE_ENV=production BABEL_ENV=coverage nyc --reporter=lcov --reporter=text mocha $npm_package_config_mocha",
"test:watch": "defaultenv env/local.js cross-env NODE_ENV=production BABEL_ENV=test mocha --watch $npm_package_config_mocha",
"test:debug": "defaultenv env/local.js cross-env NODE_ENV=production BABEL_ENV=test mocha --inspect-brk $npm_package_config_mocha",
"codecov": "nyc report --reporter=text-lcov > coverage.lcov; codecov",
"prepublishOnly": "npm run clean && npm run prettier:check && npm run lint && flow && npm test && npm run build",
"open:coverage": "open coverage/lcov-report/index.html",
Expand Down
6 changes: 4 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ export class ShardRegistrar extends EventEmitter<Events> {
let startTime = Date.now()
let delay
this._register().catch((err: Error) => {
console.error(err.stack) // eslint-disable-line no-console
if (this._running) {
console.error(err.stack) // eslint-disable-line no-console
}
delay = 100
})
delay = Math.max(
Expand All @@ -134,6 +136,7 @@ export class ShardRegistrar extends EventEmitter<Events> {
async _register(): Promise<void> {
const { _holder: holder } = this
const { cluster, heartbeatInterval, gracePeriod } = this._options
const interval = `${heartbeatInterval + gracePeriod} seconds`

try {
if (!this._upsertedCluster) {
Expand All @@ -142,7 +145,6 @@ export class ShardRegistrar extends EventEmitter<Events> {
}

await this._query('BEGIN;')
const interval = `${heartbeatInterval + gracePeriod} seconds`
let result

await this._query(lockQuery, [cluster])
Expand Down

0 comments on commit 2850b83

Please sign in to comment.