Skip to content

Search param cache, Reindex: Replace blind wait by sync check#5432

Open
SergeyGaluzo wants to merge 9 commits intomainfrom
users/sergal/search-param-cache-sync-check
Open

Search param cache, Reindex: Replace blind wait by sync check#5432
SergeyGaluzo wants to merge 9 commits intomainfrom
users/sergal/search-param-cache-sync-check

Conversation

@SergeyGaluzo
Copy link
Copy Markdown
Contributor

Replaces blind wait for 3 cache refresh intervals with check for sync with the database.

@SergeyGaluzo SergeyGaluzo requested a review from a team as a code owner March 9, 2026 23:36
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@23706d8). Learn more about missing BASE report.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #5432   +/-   ##
=======================================
  Coverage        ?   76.93%           
=======================================
  Files           ?      975           
  Lines           ?    35547           
  Branches        ?     5329           
=======================================
  Hits            ?    27347           
  Misses          ?     6875           
  Partials        ?     1325           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

_operationsConfiguration.Reindex.CacheRefreshMaxWaitIntervals,
cancellationToken);
cacheLastUpdated = _searchParameterOperations.SearchParamLastUpdated.HasValue ? _searchParameterOperations.SearchParamLastUpdated.Value : DateTimeOffset.MinValue;
isBad = _reindexProcessingJobDefinition.SearchParamLastUpdated > cacheLastUpdated;

Check warning

Code scanning / CodeQL

Useless assignment to local variable Warning

This assignment to
isBad
is useless, since its value is never read.

Copilot Autofix

AI about 1 month ago

Generally, to fix a “useless assignment to local variable” you either (a) remove the assignment if its result is not needed, or (b) start using the variable in a meaningful way if the recomputed value is actually required. Here, the recomputation of isBad after the cache sync wait is not used anywhere, and the assignment has no side effects. The simplest, behavior-preserving fix is to remove that assignment line.

Concretely, in CheckSync in src/Microsoft.Health.Fhir.Core/Features/Operations/Reindex/ReindexProcessingJob.cs, remove the line:

isBad = _reindexProcessingJobDefinition.SearchParamLastUpdated > cacheLastUpdated;

at line 155, and leave the subsequent recomputation of cacheLastUpdatedStr and logging logic unchanged. No new imports, methods, or other definitions are needed, since we’re only deleting an unused assignment.

Suggested changeset 1
src/Microsoft.Health.Fhir.Core/Features/Operations/Reindex/ReindexProcessingJob.cs

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/Microsoft.Health.Fhir.Core/Features/Operations/Reindex/ReindexProcessingJob.cs b/src/Microsoft.Health.Fhir.Core/Features/Operations/Reindex/ReindexProcessingJob.cs
--- a/src/Microsoft.Health.Fhir.Core/Features/Operations/Reindex/ReindexProcessingJob.cs
+++ b/src/Microsoft.Health.Fhir.Core/Features/Operations/Reindex/ReindexProcessingJob.cs
@@ -152,7 +152,6 @@
                     _operationsConfiguration.Reindex.CacheRefreshMaxWaitIntervals,
                     cancellationToken);
                 cacheLastUpdated = _searchParameterOperations.SearchParamLastUpdated.HasValue ? _searchParameterOperations.SearchParamLastUpdated.Value : DateTimeOffset.MinValue;
-                isBad = _reindexProcessingJobDefinition.SearchParamLastUpdated > cacheLastUpdated;
 
                 cacheLastUpdatedStr = cacheLastUpdated.ToString(ReindexOrchestratorJob.LogDateTimeFormat);
                 if (isInSync)
EOF
@@ -152,7 +152,6 @@
_operationsConfiguration.Reindex.CacheRefreshMaxWaitIntervals,
cancellationToken);
cacheLastUpdated = _searchParameterOperations.SearchParamLastUpdated.HasValue ? _searchParameterOperations.SearchParamLastUpdated.Value : DateTimeOffset.MinValue;
isBad = _reindexProcessingJobDefinition.SearchParamLastUpdated > cacheLastUpdated;

cacheLastUpdatedStr = cacheLastUpdated.ToString(ReindexOrchestratorJob.LogDateTimeFormat);
if (isInSync)
Copilot is powered by AI and may make mistakes. Always verify output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants