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

Fix TimerTask :execution_interval docs #994

Merged
merged 1 commit into from
Apr 24, 2023

Conversation

freemanoid
Copy link
Contributor

@freemanoid freemanoid commented Apr 24, 2023

This seems to be a mistake in the docs. Looking under the hood at the ScheduledTask class, you can see that Float is perfectly fine and can be passed as an execution interval. This PR changes Integer to Float in the method description to avoid any confusion.

# @param [Float] delay the number of seconds to wait for before executing the task

I've also checked that it actually works with floats:

Concurrent::TimerTask.execute({:execution_interval => 0.1}) { puts Time.now.to_f }

1682345298.779785
1682345298.881609
1682345298.9855418
1682345299.091567
1682345299.1970491
1682345299.302599
1682345299.407186
1682345299.510379
1682345299.6152
1682345299.720865
1682345299.826708
1682345299.933086
1682345300.0387928
1682345300.144703
1682345300.2506618
1682345300.353
1682345300.4590552

This seems to be a mistake in the docs. Looking under the hood at the `ScheduledTask` class, you can see that Float is perfectly fine and can be passed as an execution interval. This PR changes `Integer` to `Float` in the method description to avoid any confusion.

https://github.com/ruby-concurrency/concurrent-ruby/blob/e7ff945661a93a2e094b3259f23ccb1b3eea9bcf/lib/concurrent-ruby/concurrent/scheduled_task.rb#L167
@eregon
Copy link
Collaborator

eregon commented Apr 24, 2023

Copy link
Collaborator

@eregon eregon left a comment

Choose a reason for hiding this comment

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

Thanks!

@eregon eregon merged commit 9f40827 into ruby-concurrency:master Apr 24, 2023
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