| 58 | path_(path) {} |
| 59 | |
| 60 | CoTryTask<std::vector<BrokenPath>> run(size_t threads, size_t coroutines) { |
| 61 | auto result = co_await meta_.stat(user_, path_.parent, path_.path, false); |
| 62 | CO_RETURN_AND_LOG_ON_ERROR(result); |
| 63 | enqueue({"", {}, *result}); |
| 64 | |
| 65 | auto exec = std::make_unique<folly::CPUThreadPoolExecutor>(threads); |
| 66 | std::vector<folly::SemiFuture<folly::Unit>> workers; |
| 67 | while (workers.size() < coroutines) { |
| 68 | workers.push_back(worker().scheduleOn(exec.get()).start()); |
| 69 | } |
| 70 | |
| 71 | while (pending_) { |
| 72 | co_await folly::coro::sleep(std::chrono::milliseconds(100)); |
| 73 | } |
| 74 | cancel_.requestCancellation(); |
| 75 | for (auto &worker : workers) { |
| 76 | worker.wait(); |
| 77 | } |
| 78 | |
| 79 | co_return broken_.withWLock([](auto &broken) { return std::exchange(broken, {}); }); |
| 80 | } |
| 81 | |
| 82 | private: |
| 83 | struct Task { |
no test coverage detected