+ bug_comments_map = {}
+ if add_comments:
+ need_set = set()
+ bugzilla = None
+ for nodes in budget_graph.assigned_nodes_for_milestones.values():
+ for node in nodes:
+ need_set.add(node.bug.id)
+ bugzilla = node.bug.bugzilla
+ need_list = sorted(need_set)
+ total = len(need_list)
+ with tty_out() as term:
+ step = 100
+ i = 0
+ while i < total:
+ cur_need = need_list[i:i + step]
+ stop = i + len(cur_need)
+ print(f"loading comments {i}:{stop} of {total}",
+ flush=True, file=term)
+ comments = bugzilla.get_comments(cur_need)['bugs']
+ if len(comments) < len(cur_need) and len(cur_need) > 1:
+ step = max(1, step // 2)
+ print(f"failed, trying smaller step of {step}",
+ flush=True, file=term)
+ continue
+ bug_comments_map.update(comments)
+ i += len(cur_need)