feat: enhance replies command progress output
This commit is contained in:
@@ -563,10 +563,12 @@ namespace URLNotesGrabberCORE
|
||||
Console.WriteLine();
|
||||
|
||||
int totalProcessedCount = 0;
|
||||
int successCount = 0;
|
||||
int totalReplies = DataAccess.GetRepliesWithFilledText()?.Count ?? 0;
|
||||
|
||||
// Get posts with missing reply text
|
||||
while (true)
|
||||
Console.WriteLine($"[Reply Text] Total replies to process: {totalReplies}");
|
||||
Console.WriteLine();
|
||||
|
||||
while (totalProcessedCount < totalReplies)
|
||||
{
|
||||
var batch = DataAccess.GetRepliesWithFilledText();
|
||||
|
||||
@@ -576,27 +578,31 @@ namespace URLNotesGrabberCORE
|
||||
break;
|
||||
}
|
||||
|
||||
Console.WriteLine($"[Reply Text] Found {batch.Count} replies to process");
|
||||
|
||||
foreach (var reply in batch)
|
||||
{
|
||||
var blogName = (reply as Tuple<string, long, long>).Item1;
|
||||
var postID = (reply as Tuple<string, long, long>).Item2;
|
||||
var timestamp = (reply as Tuple<string, long, long>).Item3;
|
||||
|
||||
Console.WriteLine($"[Reply Text] Processing {blogName}/{postID}/{timestamp}");
|
||||
|
||||
await FetchAndStoreReplyText(blogName, postID, timestamp);
|
||||
totalProcessedCount++;
|
||||
|
||||
if (totalProcessedCount % 10 == 0)
|
||||
|
||||
int remaining = totalReplies - totalProcessedCount;
|
||||
double completionPct = (totalProcessedCount / (double)totalReplies) * 100.0;
|
||||
|
||||
var previousColor = Console.ForegroundColor;
|
||||
Console.ForegroundColor = ConsoleColor.Cyan;
|
||||
Console.WriteLine($"[{remaining} remaining] [{totalProcessedCount}/{totalReplies}] ({completionPct:F1}%)");
|
||||
Console.ForegroundColor = previousColor;
|
||||
|
||||
if (totalProcessedCount % 50 == 0 && totalProcessedCount < totalReplies)
|
||||
{
|
||||
await Task.Delay(2000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Console.WriteLine($"[Reply Text] Completed. Total processed: {totalProcessedCount} posts.");
|
||||
Console.WriteLine($"[Reply Text] Complete. Total processed: {totalProcessedCount} replies.");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user