@@ -32,29 +32,30 @@ def _updater(self):
32
32
33
33
Thread (target = self .call_event , args = ["on_ready" ]).start ()
34
34
35
+ if self .running is False :
36
+ return
35
37
while True :
36
- if self .running is False :
37
- return
38
38
try :
39
- data = self .source_cloud .websocket .recv ().split ('\n ' )
40
- result = []
41
- for i in data :
42
- try :
43
- _a = cloud_activity .CloudActivity (timestamp = time .time ()* 1000 , _session = self ._session , cloud = self .cloud )
44
- if _a .timestamp < self .startup_time + 500 : # catch the on_connect message sent by TurboWarp's (and sometimes Scratch's) cloud server
45
- continue
46
- data = json .loads (i )
47
- data ["name" ] = data ["name" ].replace ("☁ " , "" )
48
- _a ._update_from_dict (data )
49
- self .call_event ("on_" + _a .type , [_a ])
50
- except Exception as e :
51
- pass
39
+ while True :
40
+ data = self .source_cloud .websocket .recv ().split ('\n ' )
41
+ result = []
42
+ for i in data :
43
+ try :
44
+ _a = cloud_activity .CloudActivity (timestamp = time .time ()* 1000 , _session = self ._session , cloud = self .cloud )
45
+ if _a .timestamp < self .startup_time + 500 : # catch the on_connect message sent by TurboWarp's (and sometimes Scratch's) cloud server
46
+ continue
47
+ data = json .loads (i )
48
+ data ["name" ] = data ["name" ].replace ("☁ " , "" )
49
+ _a ._update_from_dict (data )
50
+ self .call_event ("on_" + _a .type , [_a ])
51
+ except Exception as e :
52
+ pass
52
53
except Exception :
53
- time .sleep (0.1 ) # cooldown
54
54
print ("CloudEvents: Disconnected. Reconnecting ..." , time .time ())
55
- self .source_cloud .connect ()
56
- print ("CloudEvents: Reconnected." , time .time ())
57
- self .call_event ("on_reconnect" , [])
55
+ time .sleep (0.1 ) # cooldown
56
+ self .source_cloud .connect ()
57
+ print ("CloudEvents: Reconnected." , time .time ())
58
+ self .call_event ("on_reconnect" , [])
58
59
59
60
60
61
class CloudLogEvents (BaseEventHandler ):
0 commit comments