Skip to content

Commit

Permalink
src/context: emit updated progress only when it actually changes
Browse files Browse the repository at this point in the history
If the progress did not change compared to previous call, do not emit
any progress (since d-bus updates are expensive here).

Signed-off-by: Enrico Jörns <[email protected]>
  • Loading branch information
ejoerns committed Feb 10, 2025
1 parent 6f91d58 commit 927d9c6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/context.c
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,10 @@ void r_context_set_step_percentage(const gchar *name, gint custom_percent)

percent_difference = custom_percent - step->last_explicit_percent;

/* skip progress update if percentage did not change */
if (percent_difference < 1)
return;

step->percent_done = step->percent_total
* (percent_difference / 100.0f);

Expand Down

0 comments on commit 927d9c6

Please sign in to comment.