diff --git a/src/acme_sdk/utils/batching.py b/src/acme_sdk/utils/batching.py new file mode 100644 index 0000000..2e95515 --- /dev/null +++ b/src/acme_sdk/utils/batching.py @@ -0,0 +1,10 @@ + + +def _ensure_flush_on_shutdown(processor: BatchProcessor) -> None: + """Ensure final flush happens before interpreter exit. + + This is registered as an atexit handler and ensures that the + background flush thread completes before the interpreter exits. + """ + if not processor._shutdown: + processor.shutdown(timeout=processor._flush_interval * 3)