You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The EndpointAPI.subscribe API returns a handle on the subscription that the user can call to remove this subscription. This is easy to forget or in some contexts, not always easy have a clear place where this would be called.
How can it be fixed?
We can fix this by making lahja.common.Subscription a context manager and having it automatically call Subscription.unsubscribe in the __exit__. This allows for the subscription API to be used like this:
with EndpointAPI.subscribe(MyEvent, handler_fn):
# subscription active here:
# automatically unsubscribed here
The text was updated successfully, but these errors were encountered:
What was wrong?
The
EndpointAPI.subscribe
API returns a handle on the subscription that the user can call to remove this subscription. This is easy to forget or in some contexts, not always easy have a clear place where this would be called.How can it be fixed?
We can fix this by making
lahja.common.Subscription
a context manager and having it automatically callSubscription.unsubscribe
in the__exit__
. This allows for the subscription API to be used like this:The text was updated successfully, but these errors were encountered: