Skip to content

Commit 70851ec

Browse files
committed
[fix] Disconnect logic
1 parent 4a1b123 commit 70851ec

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

openwisp_controller/geo/channels/consumers.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,12 @@ def join_groups(self, user):
3131
super().join_groups(user)
3232
return
3333

34-
self.group_names = []
34+
self.group_name = []
3535
for org in user.organizations_managed:
3636
group = f"loci.mobile-location.organization.{org}"
37-
self.group_names.append(group)
37+
self.group_name.append(group)
3838
async_to_sync(self.channel_layer.group_add)(group, self.channel_name)
39+
40+
def disconnect(self, close_code):
41+
for group in getattr(self, "group_name", []):
42+
async_to_sync(self.channel_layer.group_discard)(group, self.channel_name)

0 commit comments

Comments
 (0)