Value popLevel2()

in squangle/mysql_client/AsyncConnectionPool.h [97:115]


  Value popLevel2(const Key& key, Pred comp) {
    if (auto it = level2_.find(key); it != level2_.end()) {
      auto test_it = it->second.begin();
      DCHECK(test_it != it->second.end());
      auto best = test_it++;
      while (test_it != it->second.end()) {
        auto res = comp(*best, *test_it);
        if (!res.hasValue()) {
          break;
        }
        if (res.value()) {
          best = test_it;
        }
        ++test_it;
      }
      return popLevel1(*best);
    }
    return Value();
  }