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

Why not close millCh when close Logger #219

Open
zxhio opened this issue Nov 18, 2024 · 0 comments
Open

Why not close millCh when close Logger #219

zxhio opened this issue Nov 18, 2024 · 0 comments

Comments

@zxhio
Copy link

zxhio commented Nov 18, 2024

When the program only needs one Logger, it works fine; however, when the program needs multiple Loggers, or the Logger is dynamic, the millCh will not be released, resulting in a goroutine leak.

#57 #80 #100 There already see 3 issues, so as a general purpose log rotation library, why not fix this?

millCh never close

func (l *Logger) millRun() {
	for range l.millCh {
		// what am I going to do, log this?
		_ = l.millRunOnce()
	}
}

func (l *Logger) Close() error {
	l.mu.Lock()
	defer l.mu.Unlock()
	return l.close()
}
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

No branches or pull requests

1 participant