Skip to content
Snippets Groups Projects
Commit d624bad1 authored by Max Piletski's avatar Max Piletski
Browse files

Update to the test which fluctuates

parent 2b334f06
No related branches found
No related tags found
2 merge requests!344Merge slb-master feature branch with master branch,!301Update to the test which fluctuates
Pipeline #210516 passed
......@@ -38,7 +38,6 @@ protected:
using MessagePoolDataStorage = segysdk::logger::MessagePool::MessagePoolDataStorage;
static constexpr size_t messagesNumb_ = 20;
static constexpr size_t threadsNumb_ = 4;
static constexpr size_t totalThreads_ = threadsNumb_ * 2;
static constexpr std::chrono::milliseconds sleepTime_ {10};
static constexpr size_t consumeSize_ = 13;
static constexpr size_t totalMessages_ = messagesNumb_ * threadsNumb_;
......@@ -52,7 +51,8 @@ protected:
void TearDown() override
{
stopConsuming_ = true;
threadPool_.joinAll();
writersPool_.joinAll();
readersPool_.joinAll();
stopConsuming_ = false;
readMessages_.clear();
messages_.clear();
......@@ -72,7 +72,7 @@ protected:
};
for (size_t i = 0; i < threadsNumb_; ++i) {
threadPool_.addWorker(std::thread(addMessages, i));
writersPool_.addWorker(std::thread(addMessages, i));
}
}
......@@ -88,7 +88,7 @@ protected:
}
};
for (size_t i = 0; i < threadsNumb_; ++i) {
threadPool_.addWorker(std::thread(consumeMessages));
readersPool_.addWorker(std::thread(consumeMessages));
}
}
......@@ -107,6 +107,8 @@ private:
void waitForReadMessages()
{
// Make sure all writers have finished their jobs
writersPool_.joinAll();
size_t retries = 3;
while (retries > 0) {
{
......@@ -139,7 +141,8 @@ private:
segysdk::logger::MessagePool pool_;
std::atomic_bool stopConsuming_ = false;
segysdk::concurrent::ThreadPool threadPool_ {totalThreads_};
segysdk::concurrent::ThreadPool writersPool_ {threadsNumb_};
segysdk::concurrent::ThreadPool readersPool_ {threadsNumb_};
MessagePoolDataStorage readMessages_;
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment