@@ -17,7 +17,8 @@ def __init__(self, *, project_id, username="python", session_id=None, cloud_host
1717 self .project_id = int (project_id )
1818 except ValueError : #non-numeric project id (possible on turbowarp's cloud server)
1919 self .project_id = str (project_id )
20- self ._ratelimited_until = 0 #deals with the 0.1 second rate limit for cloud variable sets
20+ self ._ratelimited_until = 0 #deals with the 0.1 second rate limit for cloud variable sets
21+ self ._connect_timestamp = 0 #timestamp of when the cloud connection was opened
2122 self .websocket = websocket .WebSocket ()
2223 self ._no_reconnect = False
2324 self ._connect (cloud_host = cloud_host )
@@ -86,6 +87,7 @@ def _connect(self, *, cloud_host):
8687 )
8788 except Exception :
8889 raise (_exceptions .ConnectionError )
90+ self ._connect_timestamp = time .time ()
8991
9092 def set_var (self , variable , value ):
9193 variable = variable .replace ("☁ " , "" )
@@ -142,6 +144,7 @@ def _connect(self, *, cloud_host):
142144 )
143145 except Exception :
144146 raise (_exceptions .ConnectionError )
147+ self ._connect_timestamp = time .time ()
145148
146149 def get_cloud (self , variable ):
147150 try :
@@ -318,6 +321,8 @@ def _update(self):
318321 while True :
319322 try :
320323 data = self .connection .websocket .recv ().split ('\n ' )
324+ if len (data ) > 1 and time .time () < self .connection ._connect_timestamp + 0.5 :
325+ continue
321326 result = []
322327 for i in data :
323328 try :
0 commit comments