From ab41e0353c5f9e271ba0c81df8f84e9e39eddc76 Mon Sep 17 00:00:00 2001 From: Jacob Dufault Date: Sun, 7 Jan 2018 13:37:30 -0800 Subject: [PATCH] Fix build --- src/import_pipeline.cc | 13 +++++++------ src/import_pipeline.h | 1 + 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/import_pipeline.cc b/src/import_pipeline.cc index 14f50d1d..7c289d24 100644 --- a/src/import_pipeline.cc +++ b/src/import_pipeline.cc @@ -34,8 +34,6 @@ long long GetCurrentTimeInMilliseconds() { // Send indexing progress to client if reporting is enabled. void EmitProgress(Config* config, ImportPipelineStatus* status) { - static std::atomic next_output = 0; - if (config->progressReportFrequencyMs >= 0) { auto* queue = QueueManager::instance(); Out_Progress out; @@ -54,9 +52,10 @@ void EmitProgress(Config* config, ImportPipelineStatus* status) { out.params.loadPreviousIndexCount != 0 || out.params.onIdMappedCount != 0 || out.params.onIndexedCount != 0 || out.params.activeThreads != 0; - if (!has_state || GetCurrentTimeInMilliseconds() < next_output) + if (!has_state || + GetCurrentTimeInMilliseconds() < status->next_progress_output) return; - next_output = + status->next_progress_output = GetCurrentTimeInMilliseconds() + config->progressReportFrequencyMs; } @@ -402,7 +401,8 @@ bool IndexMergeIndexUpdates() { } // namespace -ImportPipelineStatus::ImportPipelineStatus() : num_active_threads(0) {} +ImportPipelineStatus::ImportPipelineStatus() + : num_active_threads(0), next_progress_output(0) {} // Index a file using an already-parsed translation unit from code completion. // Since most of the time for indexing a file comes from parsing, we can do @@ -499,9 +499,9 @@ bool QueryDb_ImportMain(Config* config, WorkingFiles* working_files) { std::unique_ptr cache_manager = ICacheManager::Make(config); auto* queue = QueueManager::instance(); - EmitProgress(config, status); status->num_active_threads++; + EmitProgress(config, status); bool did_work = false; @@ -615,6 +615,7 @@ bool QueryDb_ImportMain(Config* config, } status->num_active_threads--; + EmitProgress(config, status); return did_work; } diff --git a/src/import_pipeline.h b/src/import_pipeline.h index 7ef89102..a8275ae8 100644 --- a/src/import_pipeline.h +++ b/src/import_pipeline.h @@ -20,6 +20,7 @@ struct WorkingFiles; struct ImportPipelineStatus { std::atomic num_active_threads; + std::atomic next_progress_output; ImportPipelineStatus(); };