question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ability to see time took in wait_for()

See original GitHub issue

Summary

The ability to see how long the user took to do x action in client.wait_for()

What is the feature request for?

The core library

The Problem

Example - I’m trying to make a typeracer command and would like to see how long the user took to answer, and I’m using wait_for() to detect the message. I can’t find a good and asynchronous way to do that.

The Ideal Solution

Maybe wait_for() can return the message AND the time it took for the user to enter the message in a tuple/list if specified in function parameters?

The Current Solution

No good solutions, not that I’m aware of

Additional Context

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

8reactions
lgaancommented, May 23, 2021

Logic for this would just be

first = await send("start")
last = await wait_for(...)
taken = last.created_at - first.created_at

This feels like a pretty niche request anyway.

1reaction
ImNimbosscommented, May 24, 2021

Couldn’t you use time.perf_counter?

Time is blocking tho

Read more comments on GitHub >

github_iconTop Results From Across the Web

waitFor + getByRole causing severe delays #820 - GitHub
My working theory is that getByRole is so expensive that it was monopolising the waitFor loop and takes a long time to relinquish...
Read more >
React Testing Library's waitFor not working - Stack Overflow
I found the answer here: React Testing Library - using 'await wait()' after fireEvent. TLDR: "You can not use wait with getBy*.
Read more >
WAITFOR (Transact-SQL) - SQL Server - Microsoft Learn
This stored procedure waits for a variable period of time and then returns information to the user as the elapsed numbers of hours,...
Read more >
WaitFor an Element | Playwright Tutorial - Part 78 - YouTube
In this video, let's understand how to use the waitfor function.Returns when element specified by locator satisfies the state option.
Read more >
Async waits in React Testing Library - Reflect.run
RTL's waitFor function returns a Promise which is resolved when either the given boolean condition is met, or the operation timed out. For...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found