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

WAIT_SLEEP_INTERVAL not working #18

Closed
primeapple opened this issue Dec 28, 2019 · 2 comments
Closed

WAIT_SLEEP_INTERVAL not working #18

primeapple opened this issue Dec 28, 2019 · 2 comments

Comments

@primeapple
Copy link

Hi,
thanks for this amazing app! I relly like the documentation, it helped me to integrate your script into my docker-compose application.

However, I found, that the WAIT_SLEEP_INTERVAL environment variable doesn't change anything. It always defaults to 1.

After that I looked into your integration test and there were no tests, where you tested a WAIT_SLEEP_INTERVAL different from 1.

Could you please investigate this?

Have a great day!

@ufoscout
Copy link
Owner

ufoscout commented Dec 28, 2019

Hi @primeapple

it seems to me that it works as expected. See:

sleep.sleep(config.wait_sleep_interval);

I added an integration test to verify it:

#[test]
fn should_sleep_the_specified_time_between_checks() {
    let start = Instant::now();
    let mut sleeper = MillisSleeper::default();
    wait::wait(&mut sleeper, &new_config("198.19.255.255:1", 2_000, 0, 0, 10, 1), &mut on_timeout);
    let elapsed = millis_elapsed(start);
    assert!(elapsed >= 2010); // attemps one connection and fails after 1000ms; then sleeps 10ms; finally connects again and fails after additional 1000ms
    assert!(elapsed < 3000);
}

@primeapple
Copy link
Author

I'm very sorry, I used an old version, where sleeping was not working yet.
This is resolved. However, I experienced another problem. For this, please see issue #19

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

No branches or pull requests

2 participants