stop using get_stats and fix the protocol overheads in the statusbar
This commit is contained in:
parent
b431368b67
commit
c33cf71b62
|
@ -120,11 +120,11 @@
|
||||||
|
|
||||||
updateStat('traffic', {
|
updateStat('traffic', {
|
||||||
value: {
|
value: {
|
||||||
value: stats.payload_download_rate,
|
value: stats.download_rate - stats.payload_download_rate,
|
||||||
formatter: Deluge.Formatters.speed
|
formatter: Deluge.Formatters.speed
|
||||||
},
|
},
|
||||||
limit: {
|
limit: {
|
||||||
value: stats.payload_upload_rate,
|
value: stats.upload_rate - stats.payload_upload_rate,
|
||||||
formatter: Deluge.Formatters.speed
|
formatter: Deluge.Formatters.speed
|
||||||
},
|
},
|
||||||
format: '{0}/{1}'
|
format: '{0}/{1}'
|
||||||
|
|
|
@ -49,6 +49,7 @@ from deluge import common, component, httpdownloader
|
||||||
from deluge.configmanager import ConfigManager
|
from deluge.configmanager import ConfigManager
|
||||||
from deluge.ui import common as uicommon
|
from deluge.ui import common as uicommon
|
||||||
from deluge.ui.client import client, Client
|
from deluge.ui.client import client, Client
|
||||||
|
from deluge.ui.coreconfig import CoreConfig
|
||||||
|
|
||||||
from deluge.ui.web.common import _
|
from deluge.ui.web.common import _
|
||||||
json = common.json
|
json = common.json
|
||||||
|
@ -133,6 +134,7 @@ class JSON(resource.Resource, component.Component):
|
||||||
d = client.daemon.get_method_list()
|
d = client.daemon.get_method_list()
|
||||||
d.addCallback(on_get_methods)
|
d.addCallback(on_get_methods)
|
||||||
component.get("Web.PluginManager").start()
|
component.get("Web.PluginManager").start()
|
||||||
|
component.get("Web").core_config.start()
|
||||||
_d.addCallback(on_client_connected)
|
_d.addCallback(on_client_connected)
|
||||||
return d
|
return d
|
||||||
|
|
||||||
|
@ -315,6 +317,7 @@ class WebApi(JSONComponent):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(WebApi, self).__init__("Web")
|
super(WebApi, self).__init__("Web")
|
||||||
self.host_list = ConfigManager("hostlist.conf.1.2", DEFAULT_HOSTS)
|
self.host_list = ConfigManager("hostlist.conf.1.2", DEFAULT_HOSTS)
|
||||||
|
self.core_config = CoreConfig()
|
||||||
|
|
||||||
def get_host(self, host_id):
|
def get_host(self, host_id):
|
||||||
"""
|
"""
|
||||||
|
@ -386,15 +389,22 @@ class WebApi(JSONComponent):
|
||||||
ui_info = {
|
ui_info = {
|
||||||
"torrents": None,
|
"torrents": None,
|
||||||
"filters": None,
|
"filters": None,
|
||||||
"stats": None
|
"stats": {
|
||||||
|
"max_download": self.core_config.get("max_download_speed"),
|
||||||
|
"max_upload": self.core_config.get("max_upload_speed"),
|
||||||
|
"max_num_connections": self.core_config.get("max_connections_global")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if not client.connected():
|
if not client.connected():
|
||||||
d.callback(ui_info)
|
d.callback(ui_info)
|
||||||
return d
|
return d
|
||||||
|
|
||||||
|
def got_connections(connections):
|
||||||
|
ui_info["stats"]["num_connections"] = connections
|
||||||
|
|
||||||
def got_stats(stats):
|
def got_stats(stats):
|
||||||
ui_info["stats"] = stats
|
ui_info["stats"].update(stats)
|
||||||
|
|
||||||
def got_filters(filters):
|
def got_filters(filters):
|
||||||
ui_info["filters"] = filters
|
ui_info["filters"] = filters
|
||||||
|
@ -411,10 +421,14 @@ class WebApi(JSONComponent):
|
||||||
d2 = client.core.get_filter_tree()
|
d2 = client.core.get_filter_tree()
|
||||||
d2.addCallback(got_filters)
|
d2.addCallback(got_filters)
|
||||||
|
|
||||||
d3 = client.core.get_stats()
|
d3 = client.core.get_session_status(["payload_download_rate", "payload_upload_rate",
|
||||||
|
"dht_nodes", "has_incoming_connections", "download_rate", "upload_rate"])
|
||||||
d3.addCallback(got_stats)
|
d3.addCallback(got_stats)
|
||||||
|
|
||||||
|
d4 = client.core.get_num_connections()
|
||||||
|
d4.addCallback(got_connections)
|
||||||
|
|
||||||
dl = DeferredList([d1, d2, d3], consumeErrors=True)
|
dl = DeferredList([d1, d2, d3, d4], consumeErrors=True)
|
||||||
dl.addCallback(on_complete)
|
dl.addCallback(on_complete)
|
||||||
return d
|
return d
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue