Fix too many timers used for clearing progress

This commit is contained in:
Kovid Goyal 2025-03-11 10:07:30 +05:30
parent 110dad7be4
commit 85d47dc64b
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

View file

@ -635,6 +635,7 @@ def __init__(
self.last_resized_at = 0.
self.started_at = monotonic()
self.created_at = time_ns()
self.clear_progress_timer: int = 0
self.current_remote_data: list[str] = []
self.current_mouse_event_button = 0
self.current_clipboard_read_ask: bool | None = None
@ -1134,7 +1135,8 @@ def clear_progress_if_needed(self, timer_id: int | None = None) -> None:
if (tab := self.tabref()) is not None:
tab.update_progress()
else:
add_timer(self.clear_progress_if_needed, 1.0, False)
if (timer_id is None and not self.clear_progress_timer) or timer_id is not None:
self.clear_progress_timer = add_timer(self.clear_progress_if_needed, 1.0, False)
def on_mouse_event(self, event: dict[str, Any]) -> bool:
event['mods'] = event.get('mods', 0) & mod_mask