diff --git a/djangochannelsrestframework/observer/generics.py b/djangochannelsrestframework/observer/generics.py index fe3eec0..16c92df 100644 --- a/djangochannelsrestframework/observer/generics.py +++ b/djangochannelsrestframework/observer/generics.py @@ -72,7 +72,8 @@ def _subscribe(self, request_id: str, groups: Set[str]): def _unsubscribe(self, request_id: str): to_remove = [] for group, request_ids in self.subscribed_requests.items(): - request_ids.remove(request_id) + if request_id in request_ids: + request_ids.remove(request_id) if not request_ids: to_remove.append(group)