Skip to content

[WIP] Fix reindex job to throw exception on cache sync failure#5483

Draft
Copilot wants to merge 1 commit intomainfrom
copilot/fix-reindex-job-exception
Draft

[WIP] Fix reindex job to throw exception on cache sync failure#5483
Copilot wants to merge 1 commit intomainfrom
copilot/fix-reindex-job-exception

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 3, 2026

Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.

Original prompt

Repo: microsoft/fhir-server
PR context: #5479 ("Distributed Cache Sync and Atomic Search Param Operations")

Task:

  1. Find the production code path in the reindex job where WaitForAllInstancesCacheSyncAsync is called.
  2. If WaitForAllInstancesCacheSyncAsync returns false, throw ReindexJobException.
    • Exception message MUST be exactly:
      "Unable to refresh search parameter cache. Please resubmit reindex. If issue persists please contact your administrator."
  3. Add/extend unit tests in ReindexJobTests to validate that when WaitForAllInstancesCacheSyncAsync returns false, the reindex job throws ReindexJobException with the exact message above.
    • Ensure the new test is deterministic and follows existing test patterns in ReindexJobTests.
    • Prefer mocking/stubbing whatever dependency provides WaitForAllInstancesCacheSyncAsync so the call returns false.
  4. Ensure existing tests still pass.

Implementation notes:

  • Do not change the message text.
  • The thrown exception type must be ReindexJobException.
  • Update using directives/usings as needed.
  • If there is existing exception handling around cache sync, integrate cleanly without breaking other behaviors.

The following is the prior conversation context from the user's chat exploration (may be truncated):

User: The task is to add code to throw ReindexJobException if WaitForAllInstancesCacheSyncAsync returns false.
Exception message should be "Unable to refresh search parameter cache. Please resubmit reindex. If issue persists please contact your administrator."
Also add an appropriate test to ReindexJobTests class.

Assistant: I’ve queued up the change and the accompanying ReindexJobTests update, and I’m waiting on your approval/response to proceed with applying the edits and finalizing the PR updates.

This pull request was created from Copilot chat.

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.

2 participants