From d6637266b7994d40d21790950040a488e17da639 Mon Sep 17 00:00:00 2001 From: jim Date: Wed, 29 Jul 2026 09:51:09 -0500 Subject: [PATCH] fix: exclude inactive blogs from blog selection queries Blogs.IsActive was honored only by GetBlogs and GetBlogsAll, so a blog with IsActive = 0 was still selected for likes crawling and for output mode. Add the filter to every remaining query that selects blog records: - GetBlogsForLikes, all three variants (specific blog, ignoreCooldown, cooldown) - this is the selector that spends API quota - GetAllBlogsWithTTFolderPath Writes are deliberately untouched. The UPDATE statements are keyed on a blog the caller already selected; filtering them would let the crawler fetch a blog, pay the API cost, then fail to persist its cursor and re-fetch the same pages on every run. Exclusion belongs at selection. LegacyPostsDbImporter is also untouched: it reads a foreign legacy schema that may not have the column. Co-Authored-By: Claude Opus 5 --- URLNotesGrabberCORE/DataAccess.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/URLNotesGrabberCORE/DataAccess.cs b/URLNotesGrabberCORE/DataAccess.cs index acd8d13..ed1ffc4 100644 --- a/URLNotesGrabberCORE/DataAccess.cs +++ b/URLNotesGrabberCORE/DataAccess.cs @@ -1040,7 +1040,8 @@ namespace URLNotesGrabberCORE COALESCE(LikesCursor, 0), COALESCE(LikesNewestTimestamp, 0) FROM Blogs - WHERE BlogName = @blog"; + WHERE BlogName = @blog + AND IsActive = 1"; } else if (ignoreCooldown) { @@ -1053,6 +1054,7 @@ namespace URLNotesGrabberCORE INNER JOIN Notes N ON N.NoteBlogName = B.BlogName WHERE N.TimeStamp >= 1535778000 AND N.rootBlogName = B.BlogName + AND B.IsActive = 1 GROUP BY B.BlogName ORDER BY MIN(N.Timestamp);"; } @@ -1067,6 +1069,7 @@ namespace URLNotesGrabberCORE INNER JOIN Notes N ON N.NoteBlogName = B.BlogName WHERE N.TimeStamp >= 1535778000 AND N.rootBlogName = B.BlogName + AND B.IsActive = 1 AND ( B.LikesPulled = 0 OR COALESCE(B.LikesLastRefreshed, 0) @@ -2211,7 +2214,7 @@ namespace URLNotesGrabberCORE using var connection = new SQLiteConnection("Data Source=" + DBPath); connection.Open(); - using var cmd = new SQLiteCommand("SELECT BlogName, TTFolderPath FROM Blogs", connection); + using var cmd = new SQLiteCommand("SELECT BlogName, TTFolderPath FROM Blogs WHERE IsActive = 1", connection); using var reader = cmd.ExecuteReader(); while (reader.Read()) {