Added: Userspace example of waiting for a specific condition.#829
Open
starrify wants to merge 4 commits intoscrapinghub:masterfrom
Open
Added: Userspace example of waiting for a specific condition.#829starrify wants to merge 4 commits intoscrapinghub:masterfrom
starrify wants to merge 4 commits intoscrapinghub:masterfrom
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 |
kmike
reviewed
Oct 20, 2018
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 |
Member
There was a problem hiding this comment.
timeout can be also implemented via splash:with_timeout
Member
There was a problem hiding this comment.
We also have a similar example in https://splash.readthedocs.io/en/stable/scripting-libs.html?#writing-modules
Member
Author
There was a problem hiding this comment.
👍 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.
Member
|
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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