speed up no-args directory import with shared connection + lazy blog cache

AddBlog/AddPost/UpdatePost/UpdatePostSetDate now reuse a single SQLiteConnection
when an import session is active, instead of opening and closing one per call.
AddBlog also short-circuits on an in-memory HashSet of blog names already
attempted this run. Other entry points are unaffected since they never call
BeginImportSession.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
This commit is contained in:
jimandClaude Opus 4.7 committed 2026-05-15 11:51:57 -05:00
1 parent 52293f2021
commit 2634ff8967
2 files changed
+84 -15

No files matched your search

+2
View File
@@ -124,10 +124,12 @@ namespace URLNotesGrabberCORE
try
{
DataAccess.EnableImportModePragmas();
DataAccess.BeginImportSession();
TraverseDirectory(settings.GetValue<string>("PathInput"), settings.GetValue<string>("PathOutputBlogs"), contains, ref postsAdded, startFromBlogName: startFromBlogName, logRecordImports: logTraversalRecordImports);
}
finally
{
DataAccess.EndImportSession();
DataAccess.RestoreImportModePragmas();
}
Console.WriteLine($"Total posts added: {postsAdded}");