Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve retry logic to handle invalid cache and no changes to Observation #161

Merged
merged 4 commits into from
Jan 25, 2022

Conversation

namalu
Copy link
Member

@namalu namalu commented Jan 24, 2022

This PR includes updates to the R4FhirImportService SaveObservationAsync logic.

Invalid cache entry:

If an Observation has been saved to the in memory cache and deleted from the FHIR server, it may take an hour for the cache to be updated. During this time, when new data is sent, PUT operations on the deleted Observation will fail. These code updates will handle the failure by removing the invalid Observation from the cache, creating a new Observation in the FHIR server, and saving the new Observation to the cache.

Observations updated repeatedly:

If a batch of data contains one or more messages that can successfully be transformed into Observations, but also contains one or more messages that will cause an "unhandled" exception, the entire batch will be retried indefinitely. The retry will include updating the successful Observations in the FHIR Server repeatedly. These code updates will check the new Observation with the existing Observation and only perform a PUT if there is a change. This will prevent unnecessary updates to Observations, and reduce requests to the FHIR Server.

@namalu namalu requested a review from a team as a code owner January 24, 2022 23:42
Copy link
Member

@dustinburson dustinburson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some suggestions to optimize but overall the changes look good.

@namalu namalu merged commit ba5c327 into master Jan 25, 2022
@dustinburson dustinburson deleted the personal/namalu/improve-retry-logic branch November 8, 2022 18:35
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