Fixed Contract filter never unsubscribing.

This commit is contained in:
Richard Moore 2020-04-15 18:09:38 -04:00
parent 284771ea39
commit 39c78f37ce
No known key found for this signature in database
GPG Key ID: 665176BE8E9DC651

View File

@ -717,13 +717,13 @@ export class Contract {
_checkRunningEvents(runningEvent: RunningEvent): void {
if (runningEvent.listenerCount() === 0) {
delete this._runningEvents[runningEvent.tag];
}
// If we have a poller for this, remove it
const emit = this._wrappedEmits[runningEvent.tag];
if (!emit) {
this.provider.off(runningEvent.filter, emit);
delete this._wrappedEmits[runningEvent.tag];
// If we have a poller for this, remove it
const emit = this._wrappedEmits[runningEvent.tag];
if (emit) {
this.provider.off(runningEvent.filter, emit);
delete this._wrappedEmits[runningEvent.tag];
}
}
}