msupply-foundation / conforma-server

Conforma application manager (IRIMS) back-end
GNU Affero General Public License v3.0
4 stars 1 forks source link

#1120 Improvements for Reviewer stats updates #1122

Closed CarlosNZ closed 2 months ago

CarlosNZ commented 3 months ago

Fix #1120

Main changes:

Additional related changes

[^1]: It was running for a single reviewer for each insert, whereas now it runs once for all reviewers. I didn't realise quite how bad it was, due to two things:

andreievg commented 2 months ago

I think it's worth handling an error in action queue: https://github.com/msupply-foundation/conforma-server/compare/1120-fix-trigger-block-for-review-stats-update...1120-fix-trigger-block-for-review-stats-update(Error-handling)

CarlosNZ commented 2 months ago

I think it's worth handling an error in action queue: 1120-fix-trigger-block-for-review-stats-update...1120-fix-trigger-block-for-review-stats-update(Error-handling)

Yeah, good call: 833703de

CarlosNZ commented 2 months ago

Is there a change that updateReviewStatsFromDBEvent will run multiple times for the same DB event ? (like when review_status_history update or review_assignment or application will be updated multiple times in sequence ?)

Not sure why that would happen. Previously there was a bit of a problem with the trigger field being set/updated/reset in quick succession causing multiple executions, hence I've tightened up those triggers (on application and review_assignment) to only respond to particular columns (i.e. NOT the trigger column).

And review_status_history only ever gets inserts, never updates (and only when the status changes).

CarlosNZ commented 2 months ago

Thanks for the review @andreievg 👍🏼