Unsubscribe on true
This commit is contained in:
parent
99846e2ad2
commit
0cbef30508
@ -317,7 +317,7 @@ export default class Contract {
|
|||||||
|
|
||||||
_sendData (subscriptionId, error, logs) {
|
_sendData (subscriptionId, error, logs) {
|
||||||
const { autoRemove, callback } = this._subscriptions[subscriptionId];
|
const { autoRemove, callback } = this._subscriptions[subscriptionId];
|
||||||
let result = false;
|
let result = true;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
result = callback(error, logs);
|
result = callback(error, logs);
|
||||||
@ -325,7 +325,7 @@ export default class Contract {
|
|||||||
console.warn('_sendData', subscriptionId, error);
|
console.warn('_sendData', subscriptionId, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (autoRemove && !result && typeof result === 'boolean') {
|
if (autoRemove && result && typeof result === 'boolean') {
|
||||||
this.unsubscribe(subscriptionId);
|
this.unsubscribe(subscriptionId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ export default class Manager {
|
|||||||
|
|
||||||
_sendData (subscriptionId, error, data) {
|
_sendData (subscriptionId, error, data) {
|
||||||
const { autoRemove, callback } = this.subscriptions[subscriptionId];
|
const { autoRemove, callback } = this.subscriptions[subscriptionId];
|
||||||
let result = false;
|
let result = true;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
result = callback(error, data);
|
result = callback(error, data);
|
||||||
@ -111,7 +111,7 @@ export default class Manager {
|
|||||||
console.error(`Unable to update callback for subscriptionId ${subscriptionId}`, error);
|
console.error(`Unable to update callback for subscriptionId ${subscriptionId}`, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (autoRemove && !result && typeof result === 'boolean') {
|
if (autoRemove && result && typeof result === 'boolean') {
|
||||||
this.unsubscribe(subscriptionId);
|
this.unsubscribe(subscriptionId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user