Skip to content

Commit 2850b83

Browse files
committed
fix: reduce error messages
1 parent b64f29f commit 2850b83

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
"flow:watch": "flow-watch -e js,js.flow,flowconfig --ignore es/ --ignore node_modules/ --watch .flowconfig --watch src/ --watch test/",
1818
"clean": "rimraf es lib $(cd src; ls) *.js.flow",
1919
"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/ .",
20-
"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",
21-
"test:watch": "cross-env NODE_ENV=production BABEL_ENV=test mocha --watch $npm_package_config_mocha",
22-
"test:debug": "cross-env NODE_ENV=production BABEL_ENV=test mocha --inspect-brk $npm_package_config_mocha",
20+
"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",
21+
"test:watch": "defaultenv env/local.js cross-env NODE_ENV=production BABEL_ENV=test mocha --watch $npm_package_config_mocha",
22+
"test:debug": "defaultenv env/local.js cross-env NODE_ENV=production BABEL_ENV=test mocha --inspect-brk $npm_package_config_mocha",
2323
"codecov": "nyc report --reporter=text-lcov > coverage.lcov; codecov",
2424
"prepublishOnly": "npm run clean && npm run prettier:check && npm run lint && flow && npm test && npm run build",
2525
"open:coverage": "open coverage/lcov-report/index.html",

src/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@ export class ShardRegistrar extends EventEmitter<Events> {
111111
let startTime = Date.now()
112112
let delay
113113
this._register().catch((err: Error) => {
114-
console.error(err.stack) // eslint-disable-line no-console
114+
if (this._running) {
115+
console.error(err.stack) // eslint-disable-line no-console
116+
}
115117
delay = 100
116118
})
117119
delay = Math.max(
@@ -134,6 +136,7 @@ export class ShardRegistrar extends EventEmitter<Events> {
134136
async _register(): Promise<void> {
135137
const { _holder: holder } = this
136138
const { cluster, heartbeatInterval, gracePeriod } = this._options
139+
const interval = `${heartbeatInterval + gracePeriod} seconds`
137140

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

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

148150
await this._query(lockQuery, [cluster])

0 commit comments

Comments
 (0)