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

Added: Userspace example of waiting for a specific condition. #829

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

starrify
Copy link
Member

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

@starrify starrify added the doc label Oct 18, 2018
@codecov
Copy link

codecov bot commented Oct 18, 2018

Codecov Report

Merging #829 into master will not change coverage.
The diff coverage is n/a.

@@           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

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
Copy link
Member

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

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

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.

@kmike
Copy link
Member

kmike commented Oct 20, 2018

Hey! I think it makes sense to have this function in the examples, and also +1 to have it built-in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants