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

Regression: Socket#connect with number timeout (deprecated) #14753

Conversation

ysbaddaden
Copy link
Contributor

fixes #14752

@ysbaddaden ysbaddaden self-assigned this Jun 25, 2024
@ysbaddaden ysbaddaden added topic:stdlib:networking kind:regression Something that used to correctly work but no longer works labels Jun 25, 2024
@@ -114,6 +114,11 @@ class Socket < IO
yield result if result.is_a?(Exception)
end

@[Deprecated("Use `#connect(addr, Time::Span?, &)` instead.")]
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't this mean the warning will say to use the block version even if you're using the blockless version?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I copied the other messages, but the deprecation message should be personalized I guess. Maybe?

Use Time::Span for timeouts instead.

Copy link
Member

Choose a reason for hiding this comment

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

Ideally each overload would have a warning specific to that overload. But also should make sure using the blockless overload doesn't trigger a warning for both since it delegates to the block version.

@straight-shoota
Copy link
Member

This doesn't really work out well without adding type restrictions to the timeout parameter in the non-deprecated overload.
We should do this anyway, but it's a step further. I think we should revert to the previous behaviour first with the patch from #14752 (comment).

@ysbaddaden ysbaddaden deleted the fix/socket-connect-deprecate-number-timeout branch June 27, 2024 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:regression Something that used to correctly work but no longer works topic:stdlib:networking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Breaking change to Crystal::System::Socket#system_connect timeout type
4 participants