Skip to content

Commit

Permalink
tmf: Handle multiple jobs when updating statistics
Browse files Browse the repository at this point in the history
When one job is already scheduled, the previous logic did not create
another job preventing subsequent selection from updating the UI in the
statistics view. This commit always computes a new job and cancels the
previous one if present.

[Fixed] Updating statistics now handles concurrent jobs correctly

Signed-off-by: Arnaud Fiorini <fiorini.arnaud@gmail.com>
  • Loading branch information
arfio authored and MatthewKhouzam committed Feb 12, 2024
1 parent 01c614c commit a05ccfe
Showing 1 changed file with 4 additions and 2 deletions.
Expand Up @@ -728,8 +728,10 @@ private void buildStatisticsTree(final ITmfTrace trace, final TmfTimeRange timeR
/* No statistics module available for this trace */
continue;
}

updateJobs.computeIfAbsent(aTrace, k -> {
updateJobs.compute(aTrace, (k, v) -> {
if (v != null) {
v.cancel(); /* Cancel previous job */
}
Job job = new StatisticsUpdateJob("Statistics update", aTrace, isGlobal, timeRange, statsMod, this); //$NON-NLS-1$
job.setSystem(true);
job.schedule();
Expand Down

0 comments on commit a05ccfe

Please sign in to comment.