Show when a server connected instead of "bytes read/written per second" in stats

endpoint
This commit is contained in:
jesopo 2019-06-14 16:12:03 +01:00
parent 3fad17d1b9
commit 50e9f56ca3

View file

@ -53,7 +53,6 @@ class Module(ModuleManager.BaseModule):
return {"networks": networks, "channels": channels, "users": users} return {"networks": networks, "channels": channels, "users": users}
def _server_stats(self, server): def _server_stats(self, server):
connected_seconds = time.time()-server.socket.connect_time
return { return {
"hostname": server.connection_params.hostname, "hostname": server.connection_params.hostname,
"port": server.connection_params.port, "port": server.connection_params.port,
@ -63,10 +62,8 @@ class Module(ModuleManager.BaseModule):
server.nickname, server.username, server.hostname), server.nickname, server.username, server.hostname),
"users": len(server.users), "users": len(server.users),
"bytes-written": server.socket.bytes_written, "bytes-written": server.socket.bytes_written,
"bytes-written-per-second":
server.socket.bytes_written/connected_seconds,
"bytes-read": server.socket.bytes_read, "bytes-read": server.socket.bytes_read,
"bytes-read-per-second": server.socket.bytes_read/connected_seconds, "connected-since": server.socket.connect_time,
"channels": { "channels": {
c.name: self._channel_stats(c) for c in server.channels c.name: self._channel_stats(c) for c in server.channels
}, },