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

TB-173 Handle transactions stuck in processing state #1208

Merged
merged 6 commits into from
Sep 15, 2023

Conversation

arran-standish
Copy link
Collaborator

If OpenHIM crashes with a request in-flight (so before the down stream service responds) this transaction will stay in 'Processing' forever and does not provide a true reflection of the transaction state.

So on startup it will find all transactions in that state and update them to failed. It uses mongoose's cursor functionality which returns a stream and so shouldn't interfere with the main application as it will only process once the stream receives data. It also properly respects node's event loop and so won't block it (i.e.: incoming requests still get processed normally).

@codecov
Copy link

codecov bot commented Sep 13, 2023

Codecov Report

Patch coverage: 91.66% and project coverage change: +0.02% 🎉

Comparison is base (4ab86ea) 86.81% compared to head (68ae11d) 86.83%.

❗ Current head 68ae11d differs from pull request most recent head cade24e. Consider uploading reports for the commit cade24e to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1208      +/-   ##
==========================================
+ Coverage   86.81%   86.83%   +0.02%     
==========================================
  Files          87       87              
  Lines        5906     5916      +10     
==========================================
+ Hits         5127     5137      +10     
  Misses        779      779              
Files Changed Coverage Δ
src/model/transactions.js 96.15% <88.88%> (-3.85%) ⬇️
src/middleware/messageStore.js 93.65% <100.00%> (+0.73%) ⬆️
src/server.js 73.27% <100.00%> (+0.09%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@arran-standish arran-standish marked this pull request as ready for review September 14, 2023 06:44
Copy link
Collaborator

@MatthewErispe MatthewErispe left a comment

Choose a reason for hiding this comment

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

Copy link
Member

@rcrichton rcrichton left a comment

Choose a reason for hiding this comment

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

LGTM

@arran-standish arran-standish merged commit 563d83c into master Sep 15, 2023
4 checks passed
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