Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ed84d6fec0 | ||
|
|
a6522779eb |
@@ -1364,32 +1364,29 @@ namespace URLNotesGrabberCORE
|
|||||||
WHERE BlogName IN ({placeholders})
|
WHERE BlogName IN ({placeholders})
|
||||||
AND IsActive = 1";
|
AND IsActive = 1";
|
||||||
}
|
}
|
||||||
else if (ignoreCooldown)
|
|
||||||
{
|
|
||||||
// All active blogs, ignore cooldown
|
|
||||||
sql = @"SELECT BlogName,
|
|
||||||
COALESCE(LikesPulled, 0),
|
|
||||||
COALESCE(LikesCursor, 0),
|
|
||||||
COALESCE(LikesNewestTimestamp, 0)
|
|
||||||
FROM Blogs
|
|
||||||
WHERE IsActive = 1
|
|
||||||
ORDER BY COALESCE(LikesLastRefreshed, 0), BlogName;";
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Backfill-pending OR refresh-due (past cooldown window)
|
// Least recently refreshed first; within that, blogs that have left a note before those
|
||||||
sql = @"SELECT BlogName,
|
// that never have, earliest first note first
|
||||||
COALESCE(LikesPulled, 0),
|
string dueFilter = ignoreCooldown ? string.Empty : @"
|
||||||
COALESCE(LikesCursor, 0),
|
|
||||||
COALESCE(LikesNewestTimestamp, 0)
|
|
||||||
FROM Blogs
|
|
||||||
WHERE IsActive = 1
|
|
||||||
AND (
|
AND (
|
||||||
COALESCE(LikesPulled, 0) = 0
|
COALESCE(B.LikesPulled, 0) = 0
|
||||||
OR COALESCE(LikesLastRefreshed, 0)
|
OR COALESCE(B.LikesLastRefreshed, 0)
|
||||||
< (CAST(strftime('%s','now') AS INTEGER) - (@cooldownDays * 86400))
|
< (CAST(strftime('%s','now') AS INTEGER) - (@cooldownDays * 86400))
|
||||||
)
|
)";
|
||||||
ORDER BY COALESCE(LikesLastRefreshed, 0), BlogName;";
|
sql = @"SELECT B.BlogName,
|
||||||
|
COALESCE(B.LikesPulled, 0),
|
||||||
|
COALESCE(B.LikesCursor, 0),
|
||||||
|
COALESCE(B.LikesNewestTimestamp, 0)
|
||||||
|
FROM Blogs B
|
||||||
|
LEFT JOIN (SELECT N.NoteBlogId, MIN(N.TimeStamp) AS FirstNoteTs
|
||||||
|
FROM Notes N" + WhereIsActive("Notes", "N", DBPath) + @"
|
||||||
|
GROUP BY N.NoteBlogId) F ON F.NoteBlogId = B.BlogId
|
||||||
|
WHERE B.IsActive = 1" + dueFilter + @"
|
||||||
|
ORDER BY COALESCE(B.LikesLastRefreshed, 0),
|
||||||
|
F.FirstNoteTs IS NULL,
|
||||||
|
F.FirstNoteTs,
|
||||||
|
B.BlogName;";
|
||||||
}
|
}
|
||||||
|
|
||||||
using (SQLiteCommand command = new SQLiteCommand(sql, connection))
|
using (SQLiteCommand command = new SQLiteCommand(sql, connection))
|
||||||
|
|||||||
Reference in new issue
Block a user