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 option for max connection #112

Merged
merged 4 commits into from
Aug 13, 2016
Merged

add option for max connection #112

merged 4 commits into from
Aug 13, 2016

Conversation

zyfdegh
Copy link
Contributor

@zyfdegh zyfdegh commented Aug 10, 2016

add option in config file

@@ -274,6 +280,12 @@ func (app *App) makeServer(addr string, handler *http.Handler) (*http.Server, er
}

func (app *App) handleWS(w http.ResponseWriter, r *http.Request) {
if app.options.MaxConnection != 0 {
if connection >= app.options.MaxConnection {
log.Printf("reached max connection: %d", app.options.MaxConnection)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log messages should start with a capital letter

@yudai
Copy link
Owner

yudai commented Aug 11, 2016

Hi, thank you for the PR. I think MaxConnection makes sense and is useful.
I put some comments to get your PR to be merged.

@zyfdegh
Copy link
Contributor Author

zyfdegh commented Aug 12, 2016

Thanks for your consideration of my PR. I've rearranged log and moved var connection as you commented. But I think it's better to log into a separate line, it's more readable.

@yudai
Copy link
Owner

yudai commented Aug 12, 2016

@zyfdegh Thanks for the update.
I want to keep the log in a single line.

  • If the log for a single event is separated into multiple lines, it's hard to track events, especially gotty receives two or more requests in a small duration
  • The current number of connections is not so important information enough to give it a dedicated line for most use cases

I therefore want to merge the lines both on opening and closing connections.

@zyfdegh
Copy link
Contributor Author

zyfdegh commented Aug 12, 2016

Okay, I forgot about concurrency. Logs are merged now. ;-)

@yudai yudai merged commit be07d42 into yudai:master Aug 13, 2016
@yudai
Copy link
Owner

yudai commented Aug 13, 2016

Thanks!

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