Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions src/VecSim/algorithms/svs/svs_tiered.h
Original file line number Diff line number Diff line change
Expand Up @@ -992,9 +992,19 @@ class TieredSVSIndex : public VecSimTieredIndex<DataType, float> {
.updateJobWaitTime = this->updateJobWaitTime,
};
{
std::lock_guard<std::mutex> lock(this->updateJobMutex);
svsTieredInfo.indexUpdateScheduled =
this->indexUpdateScheduled.test() == VecSimBool_TRUE;
// Use try_lock to avoid blocking the main thread during long-running
// training operations. updateSVSIndexWrapper holds updateJobMutex for
// the entire training duration (which can take 40-85s on slow machines).
// If the mutex is held, training is actively running, so we report
// indexUpdateScheduled = true (BACKGROUND_INDEXING = 1).
std::unique_lock<std::mutex> lock(this->updateJobMutex, std::try_to_lock);
if (lock.owns_lock()) {
svsTieredInfo.indexUpdateScheduled =
this->indexUpdateScheduled.test() == VecSimBool_TRUE;
} else {
// Mutex is held by updateSVSIndexWrapper — training is in progress.
svsTieredInfo.indexUpdateScheduled = true;
}
}
info.tieredInfo.specificTieredBackendInfo.svsTieredInfo = svsTieredInfo;
info.tieredInfo.backgroundIndexing =
Expand Down
Loading