-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Use timer:time for non-negative timeout values #9574
base: master
Are you sure you want to change the base?
Use timer:time for non-negative timeout values #9574
Conversation
As suggested in erlang#9515. In some parts of the code, `pos_integer()` is currently used for timeouts, which can't be replaced with `timer:time()` as it is specified as `integer() >= 0`. Locally tested by running dialyzer with updated preloaded code.
CT Test Results 12 files 268 suites 4h 29m 38s ⏱️ For more details on these failures, see this check. Results for commit 07f6622. ♻️ This comment has been updated with latest results. To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass. See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally. Artifacts// Erlang/OTP Github Action Bot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The socket module have for documentation purposes divided the timeout() type into its two parts so I do not think we should use the timer type here.
@@ -198,7 +198,7 @@ All TCP socket options are accepted except `active`, `binary`, `deliver`, | |||
Options :: | |||
[{port, integer()} | | |||
{log, function()} | | |||
{timeout, integer()} | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We consider this a documenation bug, should be timeout()
millisec_passed(T0) -> | ||
%% OTP 18 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good
@@ -290,7 +290,7 @@ way, option `send_timeout` comes in handy. | |||
{reuseaddr, boolean()} | | |||
{reuseport, boolean()} | | |||
{reuseport_lb, boolean()} | | |||
{send_timeout, non_neg_integer() | infinity} | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We think timeout() should be used
@@ -47,7 +47,7 @@ | |||
-define(DETS_CALL(Pid, Req), {'$dets_call', Pid, Req}). | |||
|
|||
-type access() :: 'read' | 'read_write'. | |||
-type auto_save() :: 'infinity' | non_neg_integer(). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We think timeout() should be used
@@ -311,7 +311,7 @@ corresponding value can be of any type.[](){: #ci_control_pid } | |||
The timeout time is in milliseconds. A value of 0 (zero) means that the proxy | |||
process will exit directly after the reply has been delivered. | |||
|
|||
Value type: [non_neg_integer()](`t:erlang:non_neg_integer/0`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bmk I this wanted ?
@@ -259,7 +259,7 @@ _Options:_ | |||
{overload_check, {MSec, Module, Function}} | {flush, MSec} | | |||
resume | {resume, MSec} | {queue_size, non_neg_integer()}, | |||
TimerSpec :: MSec | {MSec, stop_opts()}, | |||
MSec :: integer(), | |||
MSec :: timer:time(), | |||
Module :: atom(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably ok, anyone think differently ?
@@ -408,7 +408,7 @@ corresponding value can be of any type.[](){: #ci_control_pid } | |||
|
|||
See also [transaction sender](megaco_run.md#transaction_sender) for more info. | |||
|
|||
Value type: [non_neg_integer()](`t:erlang:non_neg_integer/0`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bmk I this wanted ?
@@ -170,7 +170,7 @@ get_disk_info(Path) -> | |||
-doc """ | |||
Returns the time interval, in milliseconds, for the periodic disk space check. | |||
""". | |||
-spec get_check_interval() -> Milliseconds :: integer(). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably ok, anyone think differently ?
@@ -246,7 +246,7 @@ get_system_memory_data() -> | |||
-doc """ | |||
Returns the time interval, in milliseconds, for the periodic memory check. | |||
""". | |||
-spec get_check_interval() -> Milliseconds :: integer(). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably ok, anyone think differently ?
@jchristgit This became quite hard to review as it changes so many different applications at once. Although the changes are similar in one way there are quite a few things to consider. And that is why I add quite a few reviewers for this so maybe wait a little before deciding how to proceed. |
@IngelaAndin thanks for the review. Sorry, I hope I don't cause too much trouble! I've pushed a second commit that addresses your comments where the outcome was clear. I didn't update the existing commit in case we want to change something there, will squash when everything looks good. |
As suggested in #9515. In some parts of the code,
pos_integer()
is currently used for timeouts, which can't be replaced withtimer:time()
as it is specified asinteger() >= 0
.Locally tested by running dialyzer with updated preloaded code.