fix exit hanging
This commit is contained in:
@@ -26,7 +26,17 @@ DEFAULT_SYNC_INTERVAL = 300
|
||||
# SPINNER_FRAMES = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"]
|
||||
# Alternative spinners you could use:
|
||||
# SPINNER_FRAMES = ["◢", "◣", "◤", "◥"] # Rotating triangle
|
||||
SPINNER_FRAMES = ["▰▱▱▱▱", "▰▰▱▱▱", "▰▰▰▱▱", "▰▰▰▰▱", "▰▰▰▰▰", "▱▰▰▰▰", "▱▱▰▰▰", "▱▱▱▰▰", "▱▱▱▱▰"] # Loading bar
|
||||
SPINNER_FRAMES = [
|
||||
"▰▱▱▱▱",
|
||||
"▰▰▱▱▱",
|
||||
"▰▰▰▱▱",
|
||||
"▰▰▰▰▱",
|
||||
"▰▰▰▰▰",
|
||||
"▱▰▰▰▰",
|
||||
"▱▱▰▰▰",
|
||||
"▱▱▱▰▰",
|
||||
"▱▱▱▱▰",
|
||||
] # Loading bar
|
||||
# SPINNER_FRAMES = ["⣾", "⣽", "⣻", "⢿", "⡿", "⣟", "⣯", "⣷"] # Braille dots
|
||||
# SPINNER_FRAMES = ["◐", "◓", "◑", "◒"] # Circle quarters
|
||||
# SPINNER_FRAMES = ["⠁", "⠂", "⠄", "⡀", "⢀", "⠠", "⠐", "⠈"] # Braille orbit
|
||||
@@ -296,6 +306,13 @@ class SyncDashboard(App):
|
||||
self._log_to_task("archive", "Dashboard initialized. Waiting to start sync...")
|
||||
self._mounted.set()
|
||||
|
||||
def on_unmount(self) -> None:
|
||||
"""Clean up when the dashboard is unmounted."""
|
||||
if self._countdown_task:
|
||||
self._countdown_task.cancel()
|
||||
if self._spinner_task:
|
||||
self._spinner_task.cancel()
|
||||
|
||||
def on_list_view_selected(self, event: ListView.Selected) -> None:
|
||||
"""Handle task selection from the list."""
|
||||
if isinstance(event.item, TaskListItem):
|
||||
@@ -677,4 +694,13 @@ async def run_dashboard_sync():
|
||||
await asyncio.sleep(1)
|
||||
|
||||
# Run dashboard and sync loop concurrently
|
||||
await asyncio.gather(dashboard.run_async(), sync_loop())
|
||||
# When dashboard exits, cancel the sync loop
|
||||
sync_task = asyncio.create_task(sync_loop())
|
||||
try:
|
||||
await dashboard.run_async()
|
||||
finally:
|
||||
sync_task.cancel()
|
||||
try:
|
||||
await sync_task
|
||||
except asyncio.CancelledError:
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user