Some more small cleanup

This commit is contained in:
Jacob Dufault 2017-07-30 00:16:08 -07:00
parent 6d9e4242d1
commit 85f3c00376

View File

@ -913,7 +913,8 @@ bool IndexMain_DoCreateIndexUpdate(
return false; return false;
Timer time; Timer time;
IndexUpdate update = IndexUpdate::CreateDelta(response->previous_id_map.get(), response->current_id_map.get(), IndexUpdate update = IndexUpdate::CreateDelta(
response->previous_id_map.get(), response->current_id_map.get(),
response->previous_index.get(), response->current_index.get()); response->previous_index.get(), response->current_index.get());
response->perf.index_make_delta = time.ElapsedMicrosecondsAndReset(); response->perf.index_make_delta = time.ElapsedMicrosecondsAndReset();
@ -2870,21 +2871,17 @@ bool QueryDbMainLoop(
Timer time; Timer time;
assert(request->current); assert(request->current);
std::shared_ptr<CacheManager::Entry> previous; // Build IdMap for the new instance. Replace the value in the cache.
std::shared_ptr<CacheManager::Entry> current; auto id_map_current = std::make_shared<IdMap>(db, request->current->id_cache);
{ std::shared_ptr<CacheManager::Entry> current = std::make_shared<CacheManager::Entry>(request->current, id_map_current);
auto id_map = std::make_shared<IdMap>(db, request->current->id_cache); std::shared_ptr<CacheManager::Entry> previous = db_cache->UpdateAndReturnOldFile(current);
std::shared_ptr<CacheManager::Entry> current0 =
std::make_shared<CacheManager::Entry>(std::move(request->current),
std::move(id_map));
current = current0;
previous = db_cache->UpdateAndReturnOldFile(std::move(current0));
}
// Let response know about previous id map, if available.
if (previous) { if (previous) {
response.previous_id_map = std::move(previous->ids); response.previous_id_map = previous->ids;
response.previous_index = std::move(previous->file); response.previous_index = previous->file;
} }
// Let response know about current id map, if available.
response.current_id_map = current->ids; response.current_id_map = current->ids;
response.current_index = current->file; response.current_index = current->file;
response.perf.querydb_id_map = time.ElapsedMicrosecondsAndReset(); response.perf.querydb_id_map = time.ElapsedMicrosecondsAndReset();