Sfoglia il codice sorgente

auto commit

master
jfinn 3 anni fa
parent
commit
0cb94c67e4
1 ha cambiato i file con 43 aggiunte e 1 eliminazioni
  1. 43
    1
      wsps/tasks_loop.py

+ 43
- 1
wsps/tasks_loop.py Vedi File

20
 async def anop(*a,**kw):pass
20
 async def anop(*a,**kw):pass
21
 def nop(*a,**kw):pass
21
 def nop(*a,**kw):pass
22
 
22
 
23
+def connect_redis():
24
+	return redis.Redis(host='localhost', port=6379, db=0,charset="utf-8", decode_responses=True, encoding_errors="backslashreplace")
25
+
23
 
26
 
24
 '''
27
 '''
25
 # '''
28
 # '''
32
 		# for now we are not going to do any weird class stuff
35
 		# for now we are not going to do any weird class stuff
33
 		cls = self.__class__
36
 		cls = self.__class__
34
 		cls.init_cnt += 1
37
 		cls.init_cnt += 1
35
-
38
+		self.r = connect_redis()
36
 		pass
39
 		pass
37
 	async def persistent_loop(self,*a,**kw):
40
 	async def persistent_loop(self,*a,**kw):
38
 		pass
41
 		pass
50
 
53
 
51
 
54
 
52
 
55
 
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+
64
+def redis_info():
65
+	rconn = glob_cl.r
66
+	keys = rconn.keys()
67
+	for k in keys():
68
+		p(":",k)
69
+
70
+	p("len(keys)",len(keys))
71
+	print("",end="",flush=True)
72
+redis_info()
73
+r"""
74
+
75
+def atexit_fn():
76
+    pass
77
+    # rconn.flushall()
78
+    print("ATEXIT FN")
79
+    rinfo_len()
80
+    keys = rconn.keys()
81
+    print(keys)
82
+    print(len(keys))
83
+    print("t 000")
84
+    # time.sleep(10)
85
+    print("t 010")
86
+    # time.sleep(20)
87
+    print("t 020")
88
+    print("ATEXIT FN...")
89
+    rconn.flushall()
90
+atexit.register(atexit_fn)
91
+
92
+
93
+
94
+# """

Loading…
Annulla
Salva