Mercurial > libervia-backend
changeset 4000:2d59974a8e3e
core (xmpp): improve pluging timing log by using highest `profileConnected` time:
previously the first `profileConnected` time was used, however it may not be the highest
(if `profileConnecting` is high but not `profileConnected`).
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 10 Mar 2023 17:01:09 +0100 |
parents | f7fa3993df28 |
children | 32d714a8ea51 |
files | sat/core/xmpp.py |
diffstat | 1 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/sat/core/xmpp.py Sat Mar 04 22:21:28 2023 +0100 +++ b/sat/core/xmpp.py Fri Mar 10 17:01:09 2023 +0100 @@ -297,6 +297,9 @@ list_d = defer.DeferredList(conn_cb_list) def logPluginResults(results): + if not results: + log.info("no plugin loaded") + return all_succeed = all([success for success, result in results]) if not all_succeed: log.error(_("Plugins initialisation error")) @@ -304,12 +307,13 @@ if not success: plugin_name = plugin_conn_cb[idx][0]._info["import_name"] log.error(f"error (plugin {plugin_name}): {result}") + + log.debug(f"Plugin loading time for {profile!r} (longer to shorter):\n") plugins_by_timer = sorted( connection_timer, key=lambda p: connection_timer[p]["total"], reverse=True ) - log.debug(f"Plugin loading time for {profile!r} (longer to shorter):\n") # total is the addition of all connecting and connected, doesn't really # reflect the real loading time as connected are launched in a # DeferredList @@ -318,7 +322,7 @@ # longuest connected (connected happen in parallel, thus the longuest is # roughly the total time for connected) total_real = 0 - total_real_first_connected = False + total_real = max(t.get("connected", 0) for t in connection_timer.values()) for plugin in plugins_by_timer: name = plugin._info["import_name"] @@ -334,10 +338,6 @@ connected = f"{timer['connected']:.2f}s" except KeyError: connected = "n/a" - else: - if not total_real_first_connected: - total_real += timer['connected'] - total_real_first_connected = True log.debug( f" - {name}: total={timer['total']:.2f}s " f"connecting={connecting} connected={connected}"