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:
@@ -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}");
|
||||
|
||||
Reference in New Issue
Block a user