mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
sync: Update sync progress even when _sync_dict is empty
By chance, _sync_dict can be empty even though repo sync is still working. In that case, the progress message shows incorrect info. Handle this case and fix a bug where "0 jobs" can show. Bug: http://b/284465096 Change-Id: If915d953ba60e7cf84a6fb2d137fd6ed82abd3cc Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/375494 Tested-by: Gavin Mak <gavinmak@google.com> Reviewed-by: Josip Sokcevic <sokcevic@google.com> Commit-Queue: Gavin Mak <gavinmak@google.com>
This commit is contained in:
parent
71122f941f
commit
945c006f40
@ -679,16 +679,20 @@ later is required to fix a server side protocol bug.
|
||||
def _GetSyncProgressMessage(self):
|
||||
earliest_time = float("inf")
|
||||
earliest_proj = None
|
||||
for project, t in self._sync_dict.items():
|
||||
items = self._sync_dict.items()
|
||||
for project, t in items:
|
||||
if t < earliest_time:
|
||||
earliest_time = t
|
||||
earliest_proj = project
|
||||
|
||||
if not earliest_proj:
|
||||
return None
|
||||
# This function is called when sync is still running but in some
|
||||
# cases (by chance), _sync_dict can contain no entries. Return some
|
||||
# text to indicate that sync is still working.
|
||||
return "..working.."
|
||||
|
||||
elapsed = time.time() - earliest_time
|
||||
jobs = jobs_str(len(self._sync_dict))
|
||||
jobs = jobs_str(len(items))
|
||||
return f"{jobs} | {elapsed_str(elapsed)} {earliest_proj}"
|
||||
|
||||
def _Fetch(self, projects, opt, err_event, ssh_proxy):
|
||||
|
Loading…
Reference in New Issue
Block a user