[booking] race on availability cache fix.

This commit is contained in:
Arsentiy Milchakov 2017-12-15 10:38:41 +03:00 committed by Roman Kuznetsov
parent 44b0969ecb
commit cf3e035b45

View file

@ -224,11 +224,15 @@ void Filter::FilterAvailability(search::Results const & results,
auto const apiCallback =
[cb, hotelToResults, availabilityCache](std::vector<std::string> hotelIds) mutable
{
search::Results results;
std::sort(hotelIds.begin(), hotelIds.end());
UpdateCache(hotelToResults, hotelIds, *availabilityCache);
FillResults(std::move(hotelToResults), hotelIds, *availabilityCache, results);
cb(results);
GetPlatform().RunTask(Platform::Thread::File,
[cb, hotelToResults, availabilityCache, hotelIds]() mutable
{
search::Results results;
std::sort(hotelIds.begin(), hotelIds.end());
UpdateCache(hotelToResults, hotelIds, *availabilityCache);
FillResults(std::move(hotelToResults), hotelIds, *availabilityCache, results);
cb(results);
});
};
m_api.GetHotelAvailability(m_currentParams, apiCallback);