Skip to content

Commit

Permalink
Reduce default poll time from 50ms to 10ms
Browse files Browse the repository at this point in the history
Some testcases (e.g. node.fork_publish) are racy because too many things can happen between 2 polls. While this doesn't fix the racy testcase, it greatly reduces the likelyhood that testcases are failing due to timing issues
  • Loading branch information
gr0vity committed Dec 5, 2024
1 parent 61e6a6b commit 16bf30b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nano/test_common/system.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ namespace test
/** Generate work with difficulty between \p min_difficulty_a (inclusive) and \p max_difficulty_a (exclusive) */
uint64_t work_generate_limited (nano::block_hash const & root_a, uint64_t min_difficulty_a, uint64_t max_difficulty_a);
/**
* Polls, sleep if there's no work to be done (default 50ms), then check the deadline
* Polls, sleep if there's no work to be done (default 10ms), then check the deadline
* @returns 0 or nano::deadline_expired
*/
std::error_code poll (std::chrono::nanoseconds const & sleep_time = std::chrono::milliseconds (50));
std::error_code poll (std::chrono::nanoseconds const & sleep_time = std::chrono::milliseconds (10));
std::error_code poll_until_true (std::chrono::nanoseconds deadline, std::function<bool ()>);
void delay_ms (std::chrono::milliseconds const & delay);
void deadline_set (std::chrono::duration<double, std::nano> const & delta);
Expand Down

0 comments on commit 16bf30b

Please sign in to comment.