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

Combine server bind_tcp and listen #1622

Merged
merged 2 commits into from
Nov 29, 2021

Conversation

matthewmcgarvey
Copy link
Member

HTTP::Server#listen provides an overload that does exactly what we are doing on two lines.

https://crystal-lang.org/api/1.0.0/HTTP/Server.html#listen(host:String,port:Int32,reuse_port:Bool=false)-instance-method

server.bind_tcp host, port
server.listen
server.listen(host, port)
Copy link
Member

Choose a reason for hiding this comment

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

Why do we even define this here? We end up overriding it in the generated apps https://github.com/luckyframework/lucky_cli/blob/master/src/web_app_skeleton/src/app_server.cr.ecr#L28-L32 which includes the extra arg for the reuse_port... 🤔 Seems like we could just make this method abstract, then do this cleanup on the CLI repo. What do you think?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch, I made the update here and opened luckyframework/lucky_cli#699

@matthewmcgarvey matthewmcgarvey merged commit 33cc97b into luckyframework:master Nov 29, 2021
@matthewmcgarvey matthewmcgarvey deleted the server-listen branch November 29, 2021 15:57
@jwoertink jwoertink added the BREAKING CHANGE This will cause a breaking change label Nov 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BREAKING CHANGE This will cause a breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants