Skip to content

Commit 2ed32b3

Browse files
committed
Do not use pooling so that we do not need to clear pool
1 parent c8e82cb commit 2ed32b3

File tree

2 files changed

+4
-20
lines changed

2 files changed

+4
-20
lines changed

Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,6 @@ private void LoadFaviconsFromDb(string dbPath, List<Bookmark> bookmarks)
155155
return;
156156
}
157157

158-
// Cache connection for pool clean
159-
SqliteConnection connection1 = null;
160-
161158
try
162159
{
163160
// Since some bookmarks may have same favicon id, we need to record them to avoid duplicates
@@ -167,7 +164,8 @@ private void LoadFaviconsFromDb(string dbPath, List<Bookmark> bookmarks)
167164
Parallel.ForEach(bookmarks, bookmark =>
168165
{
169166
// Use read-only connection to avoid locking issues
170-
var connection = new SqliteConnection($"Data Source={tempDbPath};Mode=ReadOnly");
167+
// Do not use pooling so that we do not need to clear pool: https://github.com/dotnet/efcore/issues/26580
168+
var connection = new SqliteConnection($"Data Source={tempDbPath};Mode=ReadOnly;Pooling=false");
171169
connection.Open();
172170

173171
try
@@ -221,7 +219,6 @@ ORDER BY b.width DESC
221219
{
222220
// Cache connection and clear pool after all operations to avoid issue:
223221
// ObjectDisposedException: Safe handle has been closed.
224-
connection1 = connection;
225222
connection.Close();
226223
connection.Dispose();
227224
}
@@ -235,11 +232,6 @@ ORDER BY b.width DESC
235232
// Delete temporary file
236233
try
237234
{
238-
// https://github.com/dotnet/efcore/issues/26580
239-
if (connection1 != null)
240-
{
241-
SqliteConnection.ClearPool(connection1);
242-
}
243235
File.Delete(tempDbPath);
244236
}
245237
catch (Exception ex)

Plugins/Flow.Launcher.Plugin.BrowserBookmark/FirefoxBookmarkLoader.cs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,6 @@ private void LoadFaviconsFromDb(string dbPath, List<Bookmark> bookmarks)
142142
return;
143143
}
144144

145-
// Cache connection for pool clean
146-
SqliteConnection connection1 = null;
147-
148145
try
149146
{
150147
// Since some bookmarks may have same favicon id, we need to record them to avoid duplicates
@@ -154,7 +151,8 @@ private void LoadFaviconsFromDb(string dbPath, List<Bookmark> bookmarks)
154151
Parallel.ForEach(bookmarks, bookmark =>
155152
{
156153
// Use read-only connection to avoid locking issues
157-
var connection = new SqliteConnection($"Data Source={tempDbPath};Mode=ReadOnly");
154+
// Do not use pooling so that we do not need to clear pool: https://github.com/dotnet/efcore/issues/26580
155+
var connection = new SqliteConnection($"Data Source={tempDbPath};Mode=ReadOnly;Pooling=false");
158156
connection.Open();
159157

160158
try
@@ -217,7 +215,6 @@ ORDER BY i.width DESC -- Select largest icon available
217215
{
218216
// Cache connection and clear pool after all operations to avoid issue:
219217
// ObjectDisposedException: Safe handle has been closed.
220-
connection1 = connection;
221218
connection.Close();
222219
connection.Dispose();
223220
}
@@ -231,11 +228,6 @@ ORDER BY i.width DESC -- Select largest icon available
231228
// Delete temporary file
232229
try
233230
{
234-
// https://github.com/dotnet/efcore/issues/26580
235-
if (connection1 != null)
236-
{
237-
SqliteConnection.ClearPool(connection1);
238-
}
239231
File.Delete(tempDbPath);
240232
}
241233
catch (Exception ex)

0 commit comments

Comments
 (0)