Skip to content

Commit 33a57b7

Browse files
authored
Merge pull request #45 from rsksmart/ignore-if-stopped
Only emitting the stopped event if the monitor was still active and w…
2 parents 6369f01 + cfba50d commit 33a57b7

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@rsksmart/bridge-transaction-parser",
3-
"version": "1.1.1",
3+
"version": "1.1.2",
44
"description": "A tool to find interactions with the Bridge on Rootstock",
55
"main": "index.js",
66
"scripts": {

tool/live-monitor/live-monitor.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -247,15 +247,16 @@ class LiveMonitor extends EventEmitter {
247247

248248
stop() {
249249
try {
250-
this.isStarted = false;
251-
clearTimeout(this.timer);
252-
this.timer = null;
253-
this.emit(MONITOR_EVENTS.stopped, 'Live monitor stopped');
250+
if(this.isStarted || this.timer !== null) {
251+
this.isStarted = false;
252+
clearTimeout(this.timer);
253+
this.timer = null;
254+
this.emit(MONITOR_EVENTS.stopped, 'Live monitor stopped');
255+
}
254256
} catch(error) {
255257
this.emit(MONITOR_EVENTS.error, `There was an error trying to stop the live monitor: ${error.message}`);
256258
console.error(error);
257259
}
258-
259260
return this;
260261
}
261262

0 commit comments

Comments
 (0)