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 <[email protected]>
This commit is contained in:
jim
2026-07-29 09:51:24 -05:00
co-authored by Claude Opus 5
parent 2a02811003
commit d6637266b7
+5 -2
View File
@@ -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())
{