Skip to content

Conversation

@superskip
Copy link
Contributor

@superskip superskip commented Oct 31, 2025

DHIS2-20281

This PR moves the program rule execution into a separate thread, hoping this will make the UI more responsive.

Currently the worker thread will process all rule executions to completion. If the app makes a new call to the rule engine before the last call is done, the result of the ongoing execution gets discarded as soon as it is ready.

This event is useful for testing performance: #/enrollmentEventEdit?eventId=AUEQ24HuW4H&orgUnitId=DiszpKrYNg8

@superskip superskip requested a review from a team as a code owner October 31, 2025 11:39
Copy link
Contributor

@simonadomnisoru simonadomnisoru left a comment

Choose a reason for hiding this comment

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

Excellent work @superskip on adding the WebWorker! 👏
I added a few comments. I'm also wondering if we know of any specific implementations that are currently running slowly due to the rules engine, and if we can obtain their DB and use it to properly test this PR. On the Sierra Leone DB, I didn't really notice any improvement in page speed and performance.
Thank you!

@superskip
Copy link
Contributor Author

Thanks for the review @simonadomnisoru! 🎉

There actually is a slight performance improvement which can be noticed in the SL demo database (see updated PR description)! According to the redux action time stamps in the console, approximately 0.6 seconds get shaved off the delay between the button click to the UI update. I'm currently looking into what causes the remaining delay, and it seems to be because every field in the form gets re-rendered whenever a single value in the form is commited. If we just stop doing that, the editing might suddenly turn into a snappy and nice experience... I'm eager to find out! Currently working on a fix for it :-)

Copy link
Contributor

@simonadomnisoru simonadomnisoru left a comment

Choose a reason for hiding this comment

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

Looks good!

@sonarqubecloud
Copy link

@github-actions
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants