Fix incorrect counting on initial done event for time estimation

This commit is contained in:
Kovid Goyal 2022-06-26 10:55:50 +05:30
parent f77b3e778a
commit 874507efec
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -35,7 +35,7 @@ class IndexingProgress:
changed = (left, total) != (self.left, self.total)
if changed:
done_num = self.left - left
if done_num:
if done_num > 0 and self.left > -1: # initial event will have self.left == -1
self.done_events.append((done_num, time.monotonic()))
if len(self.done_events) > 50:
self.done_events.popleft()