From 30040f68e51b73e8c1e490c5006f5f80c575194e Mon Sep 17 00:00:00 2001 From: Emanuele Aina <emanuele.aina@collabora.com> Date: Mon, 6 Dec 2021 14:54:37 +0100 Subject: [PATCH] utils: Prioritize .id over .name to identify elements in thread_pool() There are more chances that an `id` property is actually unique than a `name` property, so let's attempt to use it before `name` when reporting the element `thread_pool()` is working on. Signed-off-by: Emanuele Aina <emanuele.aina@collabora.com> --- bin/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/utils.py b/bin/utils.py index 30f6573..95ef896 100644 --- a/bin/utils.py +++ b/bin/utils.py @@ -8,10 +8,10 @@ def item_id(item): itemid = None if logging.root.level <= logging.DEBUG: itemid = getattr(item, "path_with_namespace", None) - if itemid is None: - itemid = getattr(item, "name", None) if itemid is None: itemid = getattr(item, "id", None) + if itemid is None: + itemid = getattr(item, "name", None) if itemid is None and isinstance(item, str): itemid = item if itemid is None and isinstance(item, collections.Sequence): -- GitLab