fix: prevent database deadlock (eps 2)
This commit is contained in:
@@ -56,9 +56,9 @@ void configureFileDownloaderNotifications() {
|
||||
}
|
||||
|
||||
abstract final class Bootstrap {
|
||||
static Future<(Isar isar, Drift drift, DriftLogger logDb)> initDB() async {
|
||||
final drift = Drift();
|
||||
final logDb = DriftLogger();
|
||||
static Future<(Isar isar, Drift drift, DriftLogger logDb)> initDB({required bool shareAcrossIsolates}) async {
|
||||
final drift = Drift(shareAcrossIsolates: shareAcrossIsolates);
|
||||
final logDb = DriftLogger(shareAcrossIsolates: shareAcrossIsolates);
|
||||
|
||||
Isar? isar = Isar.getInstance();
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ Cancelable<T?> runInIsolateGentle<T>({
|
||||
BackgroundIsolateBinaryMessenger.ensureInitialized(token);
|
||||
DartPluginRegistrant.ensureInitialized();
|
||||
|
||||
final (isar, drift, logDb) = await Bootstrap.initDB();
|
||||
final (isar, drift, logDb) = await Bootstrap.initDB(shareAcrossIsolates: true);
|
||||
await Bootstrap.initDomain(isar, drift, logDb, shouldBufferLogs: false);
|
||||
final ref = ProviderContainer(
|
||||
overrides: [
|
||||
|
||||
Reference in New Issue
Block a user