Conversation
The log file is opened once at startup and held as a Mutex<BufWriter<File>> — one fd, forever. Daily rotation: each log() call checks Utc::now().date_naive() against the stored date. On date change, it opens a new logs-YYYY-MM-DD.txt file. If the new file can't be opened, it continues writing to the old one rather than crashing. Per-message flush: flush() is called after every write_all(), so no log message is lost in the buffer on crash. Zero panics: every fallible operation uses let _ = or if let Ok(...) — a poisoned mutex falls back to eprintln!, a failed write is silently dropped. A logger must never take down the node. listener.accept().await.unwrap() replaced with a match that prints the error and continues. A transient fd-limit spike or network hiccup no longer permanently kills the listener. Signed-off-by: dzdidi <dzdidi@protonmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Scorer crashed with
too many files opened. This PR's goal is to fix it:listener.accept().await.unwrap()replaced with a match that prints the error and continues.A transient fd-limit spike or network hiccup no longer permanently kills the listener.