diff options
| author | Ophestra Umiker <cat@ophivana.moe> | 2024-11-04 12:56:19 +0900 |
|---|---|---|
| committer | Ophestra Umiker <cat@ophivana.moe> | 2024-11-04 12:56:19 +0900 |
| commit | d7df24c9992bd29da1d775c45cb73eb7892e5f78 (patch) | |
| tree | 6473284f8646efa182accf04a74ff77fdd7e9457 /internal/fmsg/fmsg.go | |
| parent | 88abcbe0b2379b98fdf62a54432fd12aca752d3a (diff) | |
fmsg: drop messages when msgbuf is full during withhold
Logging functions are not expected to block. This change fixes multiple hangs where more than 64 messages are produced during withhold.
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
Diffstat (limited to 'internal/fmsg/fmsg.go')
| -rw-r--r-- | internal/fmsg/fmsg.go | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/internal/fmsg/fmsg.go b/internal/fmsg/fmsg.go index dbe590bf..d4027204 100644 --- a/internal/fmsg/fmsg.go +++ b/internal/fmsg/fmsg.go @@ -16,20 +16,17 @@ func SetPrefix(prefix string) { func Print(v ...any) { dequeueOnce.Do(dequeue) - queueSync.Add(1) - msgbuf <- dPrint(v) + queue(dPrint(v)) } func Printf(format string, v ...any) { dequeueOnce.Do(dequeue) - queueSync.Add(1) - msgbuf <- &dPrintf{format, v} + queue(&dPrintf{format, v}) } func Println(v ...any) { dequeueOnce.Do(dequeue) - queueSync.Add(1) - msgbuf <- dPrintln(v) + queue(dPrintln(v)) } func Fatal(v ...any) { |
