📝 clarify async backlog docs

This commit is contained in:
Nanaloveyuki
2026-06-14 00:47:07 +08:00
parent 5ce4c29760
commit b937807136
3 changed files with 13 additions and 2 deletions
+5
View File
@@ -36,6 +36,7 @@ Detailed rules explaining key parameters and behaviors
- The helper keeps yielding while `pending_count() > 0`.
- If `has_failed()` becomes `true`, waiting stops early instead of looping forever.
- This API does not close the logger or stop the worker.
- A return from `wait_idle()` therefore means either backlog reached `0` or failure interrupted normal drain progress.
- It is narrower than `shutdown()` and is useful when the logger should continue to be used later.
### How to Use
@@ -68,8 +69,12 @@ e.g.:
- If the worker was never started, pending records may not drain and callers should not expect idle progress automatically.
- If callers need backlog cleanup after a failure-short-circuit, they still need a later `close(clear=true)` or `shutdown(...)` path.
### Notes
1. Use this helper when you want a drain barrier without closing the logger.
2. Prefer `shutdown()` when lifecycle completion matters more than continued reuse.
3. Pair it with `pending_count()` or `state()` when you need to distinguish true idleness from an early stop caused by worker failure.