refactor(reporters): remove cancel_event from progress reporters
Thread cancel_event explicitly through the parameter chain (sync_run closure → download_book() → streaming calls) instead of stashing it on reporter objects as shared state. Remove the cancel_event attribute from both PlainTextReporter and ProgressReporter — cancellation is not a reporting concern. Closes #39 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
caca930c7c
commit
2930d163b2
9 files changed
+154
-9
No files matched your search
@@ -19,7 +19,6 @@ class PlainTextReporter:
|
||||
|
||||
def __init__(self, stdout: TextIO | None = None) -> None:
|
||||
self._out: TextIO = stdout or sys.stdout
|
||||
self.cancel_event: threading.Event | None = None
|
||||
|
||||
def start_download(self, book, total_bytes: int = 0) -> None:
|
||||
"""Log download start with author, title, and file size."""
|
||||
@@ -96,7 +95,6 @@ class ProgressReporter:
|
||||
# Per-book identity mapping for concurrent downloads
|
||||
self._tasks: dict[int, object] = {} # task_id -> book
|
||||
self._book_ids: dict[int, int] = {} # id(book) -> task_id
|
||||
self.cancel_event: threading.Event | None = None
|
||||
|
||||
def start_download(self, book, total_bytes: int = 0) -> callable:
|
||||
"""Start a progress bar for this book's download.
|
||||
|
||||
Reference in new issue
Block a user