mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-12 02:45:45 +02:00
fix(tiering tests): introduce wait until tieting entries num EQ/GT (#2559)
Signed-off-by: adi_holden <adi@dragonflydb.io>
This commit is contained in:
parent
4afe278487
commit
7b61b4a8fe
5 changed files with 69 additions and 55 deletions
|
@ -330,6 +330,17 @@ void BaseFamilyTest::WaitUntilLocked(DbIndex db_index, string_view key, double t
|
|||
CHECK(IsLocked(db_index, key));
|
||||
}
|
||||
|
||||
bool BaseFamilyTest::WaitUntilCondition(std::function<bool()> condition_cb,
|
||||
std::chrono::milliseconds timeout_ms) {
|
||||
auto step = 50us;
|
||||
auto timeout_micro = chrono::duration_cast<chrono::microseconds>(timeout_ms);
|
||||
int64_t steps = timeout_micro.count() / step.count();
|
||||
do {
|
||||
ThisFiber::SleepFor(step);
|
||||
} while (!condition_cb() && --steps > 0);
|
||||
return condition_cb();
|
||||
}
|
||||
|
||||
RespExpr BaseFamilyTest::Run(ArgSlice list) {
|
||||
if (!ProactorBase::IsProactorThread()) {
|
||||
return pp_->at(0)->Await([&] { return this->Run(list); });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue