Make sidebarGetPeers an async command

This commit is contained in:
shortcutme 2019-05-30 04:27:20 +02:00
parent e2e1a5b38c
commit 815fe02c83
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE

View file

@ -86,6 +86,10 @@ class UiRequestPlugin(object):
@PluginManager.registerTo("UiWebsocket")
class UiWebsocketPlugin(object):
def __init__(self, *args, **kwargs):
self.async_commands.add("sidebarGetPeers")
return super(UiWebsocketPlugin, self).__init__(*args, **kwargs)
def sidebarRenderPeerStats(self, body, site):
connected = len([peer for peer in list(site.peers.values()) if peer.connection and peer.connection.connected])
connectable = len([peer_id for peer_id in list(site.peers.keys()) if not peer_id.endswith(":0")])