Skip to content

Commit

Permalink
fix: use truthy value in ternary since 0 cause div by zero
Browse files Browse the repository at this point in the history
  • Loading branch information
z3z1ma committed Jan 21, 2024
1 parent 3921d61 commit 4b12020
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dlt/common/runtime/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ def dump_counters(self) -> None:
elapsed_time = current_time - info.start_time
items_per_second = (count / elapsed_time) if elapsed_time > 0 else 0

progress = f"{count}/{info.total}" if info.total is not None else f"{count}"
percentage = f"({count / info.total * 100:.1f}%)" if info.total is not None else ""
progress = f"{count}/{info.total}" if info.total else f"{count}"
percentage = f"({count / info.total * 100:.1f}%)" if info.total else ""
elapsed_time_str = f"{elapsed_time:.2f}s"
items_per_second_str = f"{items_per_second:.2f}/s"
message = f"[{self.messages[name]}]" if self.messages[name] is not None else ""
Expand Down

0 comments on commit 4b12020

Please sign in to comment.