Skip to content

Commit 36a65a7

Browse files
committed
Don't run startup checks if listener was already stopped
1 parent 76462dd commit 36a65a7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

index.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,9 @@ ZongJi.prototype.start = function (options = {}) {
193193
this._filters(options);
194194

195195
const testChecksum = (resolve, reject) => {
196+
if (this.stopped) {
197+
resolve();
198+
}
196199
this._isChecksumEnabled((err, checksumEnabled) => {
197200
if (err) {
198201
reject(err);
@@ -204,6 +207,9 @@ ZongJi.prototype.start = function (options = {}) {
204207
};
205208

206209
const findBinlogEnd = (resolve, reject) => {
210+
if (this.stopped) {
211+
resolve();
212+
}
207213
this._findBinlogEnd((err, result) => {
208214
if (err) {
209215
return reject(err);
@@ -279,7 +285,7 @@ ZongJi.prototype.stop = function () {
279285
this.stopped = true;
280286
// Binary log connection does not end with destroy()
281287
this.connection.destroy();
282-
this.ctrlConnection.query('KILL ' + this.connection.threadId, () => {
288+
this.ctrlConnection.query('KILL ' + this.connection.threadId, (err, result) => {
283289
if (this.ctrlConnectionOwner) {
284290
this.ctrlConnection.destroy();
285291
}

0 commit comments

Comments
 (0)