With the former behavior, if we have 101 messages and they take 30 seconds,
the client sees the progress stuck at 0% for most the processign time, only
to see it jump to 99% a fraction of a second before the competion.
This change ensures that the client sees a timely update every time the
integer percentage actually changes.
ret = -1;
break;
}
- if (++counter % 100 == 0) {
- percentage = counter*100 / max;
- if (percentage != percentage_sent && percentage < 100) {
+ percentage = (++counter * 100) / max;
+ if (percentage > percentage_sent) {
+ if (percentage < 100) {
percentage_sent = percentage;
if (i_snprintf(percentage_str,
sizeof(percentage_str), "%u\n",