Fixing a number of scaling issues:

- Missed closing of file descriptor made ForkingTaskExecutor
  silently die after running out of FDs
- Tightened up scope for locks to prevent http timeout
- Simplified threadpool
This commit is contained in:
Ian Roddis
2022-01-10 13:02:10 -04:00
parent efd4078f70
commit 53308c063d
8 changed files with 96 additions and 140 deletions

View File

@@ -15,14 +15,12 @@ TEST_CASE("threadpool", "[threadpool]")
SECTION("Adding large tasks queues with return values")
{
auto tq = std::make_shared<daggy::TaskQueue>();
std::vector<std::future<uint32_t>> res;
for (size_t i = 0; i < 100; ++i)
res.emplace_back(tq->addTask([&cnt]() {
res.emplace_back(tp.addTask([&cnt]() {
cnt++;
return cnt.load();
}));
tp.addTasks(tq);
for (auto &r : res)
r.get();
REQUIRE(cnt == 100);