Indicate that a formerly enqueued task is complete. Used by queue consumers. For each `.get` used to fetch a task, a subsequent call to `.task_done` tells the queue that the processing on the task is complete. If a `.join` is blocking, it resumes when all items have
(self)
| 272 | raise QueueEmpty |
| 273 | |
| 274 | def task_done(self) -> None: |
| 275 | """Indicate that a formerly enqueued task is complete. |
| 276 | |
| 277 | Used by queue consumers. For each `.get` used to fetch a task, a |
| 278 | subsequent call to `.task_done` tells the queue that the processing |
| 279 | on the task is complete. |
| 280 | |
| 281 | If a `.join` is blocking, it resumes when all items have been |
| 282 | processed; that is, when every `.put` is matched by a `.task_done`. |
| 283 | |
| 284 | Raises `ValueError` if called more times than `.put`. |
| 285 | """ |
| 286 | if self._unfinished_tasks <= 0: |
| 287 | raise ValueError("task_done() called too many times") |
| 288 | self._unfinished_tasks -= 1 |
| 289 | if self._unfinished_tasks == 0: |
| 290 | self._finished.set() |
| 291 | |
| 292 | def join( |
| 293 | self, timeout: Optional[Union[float, datetime.timedelta]] = None |