Stop the background thread and perform a best-effort flush.
(self, timeout: float = 5.0)
| 1042 | self._flush(key) |
| 1043 | |
| 1044 | def shutdown(self, timeout: float = 5.0) -> None: |
| 1045 | """ |
| 1046 | Stop the background thread and perform a best-effort flush. |
| 1047 | """ |
| 1048 | logger.debug("Shutting down OfflineWriteBatcher") |
| 1049 | self._stop_event.set() |
| 1050 | try: |
| 1051 | self._thread.join(timeout=timeout) |
| 1052 | except Exception: |
| 1053 | logger.exception("Error joining OfflineWriteBatcher thread") |
| 1054 | |
| 1055 | # Best-effort final flush |
| 1056 | try: |
| 1057 | self.flush_all() |
| 1058 | except Exception: |
| 1059 | logger.exception("Error during final OfflineWriteBatcher flush") |
| 1060 | |
| 1061 | # ---------- Internal helpers ---------- |
| 1062 |