| 243 | virtual ~PushIterator() {} |
| 244 | |
| 245 | Result<T> Next() { |
| 246 | std::unique_lock<std::mutex> lk(state_->mx); |
| 247 | state_->times_polled++; |
| 248 | if (!state_->cv.wait_for(lk, std::chrono::seconds(300), |
| 249 | [&] { return !state_->items.empty(); })) { |
| 250 | return Status::Invalid("Timed out waiting for PushIterator"); |
| 251 | } |
| 252 | auto next = std::move(state_->items.front()); |
| 253 | state_->items.pop(); |
| 254 | return next; |
| 255 | } |
| 256 | |
| 257 | void Push(Result<T> result) override { |
| 258 | { |