-
Notifications
You must be signed in to change notification settings - Fork 512
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
Added: Userspace example of waiting for a specific condition. #829
base: master
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #829 +/- ##
=======================================
Coverage 87.67% 87.67%
=======================================
Files 41 41
Lines 5726 5726
Branches 791 791
=======================================
Hits 5020 5020
Misses 525 525
Partials 181 181 |
docs/scripting-ref.rst
Outdated
function wait_until(splash, timeout, polling_interval, check_func, ...) | ||
-- XXX: Assuming the check function is fast enouch, as the time is not being counted. | ||
local total_waited = 0 | ||
while total_waited < timeout do |
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.
timeout can be also implemented via splash:with_timeout
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 also have a similar example in https://splash.readthedocs.io/en/stable/scripting-libs.html?#writing-modules
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.
👍 for mentioning it @kmike
I've been using splash:with_timeout
in my code already. But here I was trying to make the example short (although it's already long enough :sweat-smile:). E.g. additional code required for handling the case when the checker function times out.
Hey! I think it makes sense to have this function in the examples, and also +1 to have it built-in. |
205b829
to
7f8633e
Compare
d9899b9
to
275c021
Compare
275c021
to
00dee4a
Compare
I'm yet unsure whether it's a better idea to introduce the same functionality as Splash itself. But before that happens, an userspace example in the documentation might also help.
See also: #569 #606