🐛 fix closed async backlog accounting

This commit is contained in:
Nanaloveyuki
2026-06-14 02:06:59 +08:00
parent d9b609d064
commit 9af489336d
5 changed files with 36 additions and 3 deletions
+23
View File
@@ -91,6 +91,29 @@ async test "shutdown clear closes without worker startup" {
inspect(logger.dropped_count(), content="1")
}
async test "closed blocking logger does not add pending count on later log attempts" {
let logger = async_logger(
@bitlogger.callback_sink(fn(_) {
}),
config=AsyncLoggerConfig::new(
max_pending=2,
overflow=AsyncOverflowPolicy::Blocking,
),
min_level=@bitlogger.Level::Info,
target="async.closed.blocking",
)
logger.info("one")
logger.close(clear=true)
inspect(logger.pending_count(), content="0")
inspect(logger.dropped_count(), content="1")
logger.info("late")
inspect(logger.pending_count(), content="0")
inspect(logger.dropped_count(), content="1")
}
test "async logger config stringify roundtrips stable fields" {
let text = stringify_async_logger_config(
AsyncLoggerConfig::new(