Skip to content

Commit

Permalink
Fix backfilling commenter info progress going over 100% (#1181)
Browse files Browse the repository at this point in the history
and fix error log
  • Loading branch information
ScrubN authored Aug 6, 2024
1 parent a11b237 commit 9c1d83e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions TwitchDownloaderCore/ChatDownloader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -565,12 +565,12 @@ private async Task BackfillUserInfo(ChatRoot chatRoot)
userInfo[user.id] = user;
}

var percent = (i + BATCH_SIZE) * 100f / userIds.Length;
var percent = Math.Min(i + BATCH_SIZE, userIds.Length) * 100f / userIds.Length;
_progress.ReportProgress((int)percent);
}
catch (Exception e)
{
_progress.LogVerbose($"An error occurred while backfilling commenters {i}-{i + BATCH_SIZE}: {e.Message}");
_progress.LogVerbose($"An error occurred while backfilling commenters {i}-{Math.Min(i + BATCH_SIZE, userIds.Length - 1)}: {e.Message}");
failedInfo = true;
}
}
Expand Down

0 comments on commit 9c1d83e

Please sign in to comment.