fix: tolerate ~5s timestamp drift in UpdateNoteReplyText

The API returns reply timestamps that are ~1s ahead of what -collect
originally stored, so an exact TimeStamp match in the UPDATE was
hitting zero rows for every note - the API call worked, the reply
text came back, but nothing landed in the DB. Match within +-5s
instead. Also return rowsAffected from UpdateNoteReplyText and
report it separately from notes-seen in the summary so misses are
visible.
This commit is contained in:
jim
2026-05-07 14:10:37 -05:00
parent 1c7b6a1e86
commit 64a914c14d
2 changed files with 12 additions and 8 deletions
+5 -4
View File
@@ -455,6 +455,7 @@ namespace URLNotesGrabberCORE
Console.WriteLine($"[Reply Text] Fetching reply text for {blogName}/{postID}");
int replyCount = 0;
int rowsUpdated = 0;
int emptyReplyCount = 0;
long pageTimestamp = 0;
int page = 0;
@@ -500,7 +501,7 @@ namespace URLNotesGrabberCORE
{
if (!string.IsNullOrEmpty(note.reply_text))
{
DataAccess.UpdateNoteReplyText(blogName, postID, note.blog_name, note.timestamp, note.reply_text);
rowsUpdated += DataAccess.UpdateNoteReplyText(blogName, postID, note.blog_name, note.timestamp, note.reply_text);
replyCount++;
string displayText = note.reply_text.Length > 100
@@ -513,14 +514,14 @@ namespace URLNotesGrabberCORE
}
else
{
DataAccess.UpdateNoteReplyText(blogName, postID, note.blog_name, note.timestamp, "?");
rowsUpdated += DataAccess.UpdateNoteReplyText(blogName, postID, note.blog_name, note.timestamp, "?");
emptyReplyCount++;
Console.WriteLine($"[Reply Text] Reply from {note.blog_name} returned with empty reply_text - marked '?'");
}
}
else if (note.type == "reblog" && !string.IsNullOrEmpty(note.reply_text))
{
DataAccess.UpdateNoteReplyText(blogName, postID, note.blog_name, note.timestamp, note.reply_text);
rowsUpdated += DataAccess.UpdateNoteReplyText(blogName, postID, note.blog_name, note.timestamp, note.reply_text);
replyCount++;
string displayText = note.reply_text.Length > 100
@@ -540,7 +541,7 @@ namespace URLNotesGrabberCORE
pageTimestamp = lastNoteTimestamp;
}
Console.WriteLine($"[Reply Text] Done {blogName}/{postID}: updated={replyCount}, empty='?'={emptyReplyCount}, pages={page}");
Console.WriteLine($"[Reply Text] Done {blogName}/{postID}: notes={replyCount}, rowsUpdated={rowsUpdated}, empty='?'={emptyReplyCount}, pages={page}");
}
catch (Exception ex)
{