Use client timeout when loading a map
This commit is contained in:
parent
0ce908dbf2
commit
c821fc0e7e
|
@ -70,9 +70,10 @@ namespace detail {
|
|||
EpisodeProxy Simulator::LoadEpisode(std::string map_name) {
|
||||
const auto id = GetCurrentEpisode().GetId();
|
||||
_client.LoadEpisode(std::move(map_name));
|
||||
for (auto i = 0u; i < 10u; ++i) { // 10 attempts (at most 20 seconds).
|
||||
size_t number_of_attempts = _client.GetTimeout().milliseconds() / 10u;
|
||||
for (auto i = 0u; i < number_of_attempts; ++i) {
|
||||
using namespace std::literals::chrono_literals;
|
||||
_episode->WaitForState(2s); // Ignore time-outs.
|
||||
_episode->WaitForState(10ms);
|
||||
auto episode = GetCurrentEpisode();
|
||||
if (episode.GetId() != id) {
|
||||
return episode;
|
||||
|
|
Loading…
Reference in New Issue