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

Configurable sleeps #142

Open
zmitchell opened this issue Feb 18, 2025 · 5 comments
Open

Configurable sleeps #142

zmitchell opened this issue Feb 18, 2025 · 5 comments
Labels
C-bug Category: bug help-wanted Help wanted!

Comments

@zmitchell
Copy link

zmitchell commented Feb 18, 2025

Hi, I was integrating rexpect into a project and found that the sleeps are longer than what we needed. Specifically the sleep in read_until is 100ms, and I found that decreasing this to 5ms sped up some of our tests that are using rexpect.

thread::sleep(time::Duration::from_millis(100));

Of course I wouldn't suggest everyone using 5ms, so maybe there's room for configurability? For now I have a fork with that small change.

@epage
Copy link
Contributor

epage commented Feb 18, 2025

We already have a timeout, this is just the sleep to yield the thread within that timeout. We should probably make the sleep dependent on the timeout so we don't sleep longer than it.

I'm open to ideas of how we should calculate the sleep.

@epage epage added the C-bug Category: bug label Feb 18, 2025
@zmitchell
Copy link
Author

If I understand correctly this are two different times though in the sense that if I receive the output I'm looking for 1ms after the first run of the loop I need to wait 100ms to find out, and I incur that 100ms for each back and forth with the shell. This adds up pretty quickly in a test scenario where an rexpect-using test can take multiples of 100ms whereas other tests may take 10ms. That's more my concern.

@epage
Copy link
Contributor

epage commented Feb 18, 2025

So if I'm understanding correctly, you don't want to change the timeout, just how long until the process wakes up for it to check if its done, making this closer to a busy loop?

@zmitchell
Copy link
Author

Yes, but I want to be able to make that choice for myself. I think there are totally valid reasons that not everyone would want something closer to a busy loop.

@epage
Copy link
Contributor

epage commented Feb 19, 2025

Seems reasonable. Thanks for taking the time to clarify the request!

@epage epage added the help-wanted Help wanted! label Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug help-wanted Help wanted!
Projects
None yet
Development

No branches or pull requests

2 participants