consolidate async and native runtime updates

This commit is contained in:
Nanaloveyuki
2026-06-14 09:00:00 +08:00
parent 7d2d20c31e
commit 81385d5c0b
5 changed files with 77 additions and 13 deletions
+8 -3
View File
@@ -254,11 +254,16 @@ pub async fn[S] AsyncLogger::log(
} else {
match self.overflow {
AsyncOverflowPolicy::Blocking => {
self.queue.put(rec) catch {
err if err is AsyncLoggerClosed => ()
let accepted = (async fn() -> Bool raise {
self.queue.put(rec)
true
})() catch {
err if err is AsyncLoggerClosed => false
err => raise err
}
self.pending_count.val += 1
if accepted {
self.pending_count.val += 1
}
}
AsyncOverflowPolicy::DropOldest | AsyncOverflowPolicy::DropNewest => {
self.dropped_count.val += 1