Progress Bar is frozen and doesnt update during a long microflow loop

0
Hi everyone,I have a heavy, long-running microflow that processes a large list of employees. Inside the loop, I am updating a counter attribute (ProcessedEmployeesCount) and committing it.I opened a page with a Progress Bar and a Microflow Timer to refresh the object in the client, but the UI completely freezes. The progress bar doesn't change at all during the process, and it only updates/disappears at the very end after the entire microflow finishes.What is the best practice in Mendix to run this heavy loop in the background (asynchronously) so the UI remains unblocked and the Progress Bar can update incrementally?Thanks!
asked
2 answers
0

Use a Task Queue to run the long employee-processing microflow asynchronously (in the background), while the UI remains responsive and the progress bar updates periodically.


User clicks Start.

A small microflow creates a Progress object (Processed = 0, Total = X).

That microflow adds the heavy processing microflow to a Task Queue.

The start microflow ends immediately, so the page stays responsive.

The Task Queue processes the employees in the background and updates ProcessedEmployeesCount as it goes.

A Microflow Timer refreshes the Progress object every few seconds, so the progress bar updates until the job is complete.

answered
0

For refreshing I think https://docs.mendix.com/appstore/widgets/events/ is these days the way-to-go :)

But yeah I'd use the task queue as well. Make sure you think about error-handling and batching.


As a general guideline: Mendix does not commit when it reaches a commit activity. See https://community.mendix.com/link/spaces/microflows/questions/120781 for some more info.

answered