Skip to content
This repository was archived by the owner on Sep 30, 2023. It is now read-only.

Commit 8857b64

Browse files
committed
adding stop method to replicator class. Call replicator stop method during store close
1 parent 6365982 commit 8857b64

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/Replicator.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ class Replicator extends EventEmitter {
107107
}
108108
}
109109

110+
stop() {
111+
//Clears the queue flusher
112+
clearInterval(this._flushTimer)
113+
}
114+
110115
_addToQueue (entry) {
111116
const hash = entry.hash || entry
112117

src/Store.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,9 @@ class Store {
150150
if (this.options.onClose)
151151
await this.options.onClose(this.address.toString())
152152

153+
//Replicator teardown logic
154+
this._replicator.stop();
155+
153156
// Reset replication statistics
154157
this._replicationStatus.reset()
155158

@@ -177,9 +180,6 @@ class Store {
177180
// TODO: afaik we don't use 'closed' event anymore,
178181
// to be removed in future releases
179182
this.events.emit('closed', this.address.toString())
180-
181-
//Clears the queue flusher instatiated at ./Replicator.js:36
182-
clearInterval(this._replicator._flushTimer);
183183
return Promise.resolve()
184184
}
185185

0 commit comments

Comments
 (0)