소스 검색

auto commit

master
jfinn 2 년 전
부모
커밋
9b0a6b7bcf
1개의 변경된 파일15개의 추가작업 그리고 0개의 파일을 삭제
  1. 15
    0
      wsps/tasks_loop.py

+ 15
- 0
wsps/tasks_loop.py 파일 보기

@@ -120,6 +120,9 @@ class AconMixin(DbgMixin):
120 120
 
121 121
 class AclTaskMixin:
122 122
 	async def ws_conn0(self):
123
+		if glob_cl.has_cl:
124
+			return
125
+		glob_cl = True
123 126
 		print("AclTaskMixin:ws_conn0")
124 127
 		glob_cl.run_persistent_loop(self)
125 128
 		glob_cl.acl = self.channel_layer
@@ -156,9 +159,11 @@ Mixins.AclTaskMixin = AclTaskMixin
156 159
 
157 160
 # GCLMixin
158 161
 class globCL(GCLMixin):
162
+
159 163
 	def __init__(self,*a,**kw):
160 164
 		# for now we are not going to do any weird class stuff
161 165
 		self.acl = None
166
+		self.has_cl = False
162 167
 		self.rconn = connect_redis()
163 168
 		self.rman = RldMan()
164 169
 		self.cbs_once = []
@@ -236,6 +241,16 @@ class globCL(GCLMixin):
236 241
 		loop.create_task(self.persistent_loop())
237 242
 		self.loop = loop
238 243
 	run_persistent_loop = _run_persistent_loop
244
+
245
+
246
+	def sync_dev_group_add(self,*a,**kw):
247
+		glob_cl.cbs_once.append(group_add(*a,**kw))
248
+	async def dev_group_add(self,group_name,consumer):
249
+		channel_layer = glob_cl.acl
250
+		if not consumer.channel_name in consumer.groups_set:
251
+			consumer.groups_set.add(groups)
252
+		consumer.groups
253
+		await channel_layer.group_add(group_name,consumer.channel_name)
239 254
 		
240 255
 		
241 256
 

Loading…
취소
저장