Improved removing watchers
Added 8 sec idle time removal
This commit is contained in:
parent
8df1894524
commit
7b5adc9c05
@ -213,9 +213,9 @@ class SyncFactory(Factory):
|
|||||||
|
|
||||||
def remove_watcher(self, watcher_proto):
|
def remove_watcher(self, watcher_proto):
|
||||||
watcher = self.watchers.pop(watcher_proto, None)
|
watcher = self.watchers.pop(watcher_proto, None)
|
||||||
self.remove_room_if_empty(watcher.room)
|
|
||||||
if not watcher:
|
if not watcher:
|
||||||
return
|
return
|
||||||
|
self.remove_room_if_empty(watcher.room)
|
||||||
watcher.active = False
|
watcher.active = False
|
||||||
self.broadcast(watcher, lambda receiver: receiver.watcher_proto.send_left(watcher.name))
|
self.broadcast(watcher, lambda receiver: receiver.watcher_proto.send_left(watcher.name))
|
||||||
|
|
||||||
@ -348,7 +348,10 @@ class SyncFactory(Factory):
|
|||||||
def send_ping_to(self, watcher):
|
def send_ping_to(self, watcher):
|
||||||
if not watcher.active:
|
if not watcher.active:
|
||||||
return
|
return
|
||||||
|
if (time.time()-watcher.last_update_sent) > 8:
|
||||||
|
self.remove_watcher(watcher.watcher_proto)
|
||||||
|
return
|
||||||
|
|
||||||
chars = None
|
chars = None
|
||||||
while not chars or chars in watcher.pings_sent:
|
while not chars or chars in watcher.pings_sent:
|
||||||
chars = random_chars()
|
chars = random_chars()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user