# HG changeset patch # User Goffi # Date 1678464069 -3600 # Node ID 2d59974a8e3e99ed5ab8ea99b05993bdd2095e89 # Parent f7fa3993df28a62130b83040d071fadaf69f3860 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`). diff -r f7fa3993df28 -r 2d59974a8e3e sat/core/xmpp.py --- 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}"