Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add writer overflow behaviours more #143

Merged
merged 5 commits into from
Jan 19, 2024
Merged

Add writer overflow behaviours more #143

merged 5 commits into from
Jan 19, 2024

Conversation

hadashiA
Copy link
Contributor

#129 #131

The behavior of the WriterLoop queue when it overflows can now be configured.

Add ZLoggerOptions.FullMode,

  • BackgroundBufferFullMode.Grow (default)
    • It is the same as before. Buffer as long as memory allows.
  • BackgroundBufferFullMode.Wait
    • Wait until there's more room in the queue.
  • BackgroundBufferFullMode.Drop
    • Drop the overflowing log entry.

( There may not yet be agreement on the name of the option.

@neuecc
Copy link
Member

neuecc commented Jan 19, 2024

Is there a reason you didn't use WriteAsync()?
channel.Writer.WriteAsync(log).AsTask().Wait();

@hadashiA
Copy link
Contributor Author

Fixed to use .AsTask().Wait() .

(Personally I thought that ManualResetEvent would be less costly, but we decided to use AsTask().Wait() because it is safer to leave all control to the Channel.)

@neuecc neuecc merged commit d58c737 into master Jan 19, 2024
1 check passed
@neuecc neuecc deleted the hadashiA/glow-option branch January 19, 2024 08:25
This was referenced Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants