Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import 'package:sqlite_async/src/common/sqlite_database.dart';
import 'package:sqlite_async/src/sqlite_connection.dart';
import 'package:sqlite_async/src/sqlite_options.dart';
import 'package:sqlite_async/src/update_notification.dart';
import 'package:sqlite_async/src/web/web_mutex.dart';
import 'package:sqlite_async/src/web/web_sqlite_open_factory.dart';
import 'package:sqlite_async/web.dart';

Expand Down Expand Up @@ -43,7 +42,6 @@ class SqliteDatabaseImpl
@override
AbstractDefaultSqliteOpenFactory openFactory;

late final Mutex mutex;
late final WebDatabase _connection;
StreamSubscription? _broadcastUpdatesSubscription;

Expand Down Expand Up @@ -77,15 +75,15 @@ class SqliteDatabaseImpl
/// 4. Creating temporary views or triggers.
SqliteDatabaseImpl.withFactory(this.openFactory,
{this.maxReaders = SqliteDatabase.defaultMaxReaders}) {
mutex = MutexImpl();
// This way the `updates` member is available synchronously
updates = updatesController.stream;
isInitialized = _init();
}

Future<void> _init() async {
_connection = await openFactory.openConnection(SqliteOpenOptions(
primaryConnection: true, readOnly: false, mutex: mutex)) as WebDatabase;
_connection = await openFactory.openConnection(
SqliteOpenOptions(primaryConnection: true, readOnly: false))
as WebDatabase;

final broadcastUpdates = _connection.broadcastUpdates;
if (broadcastUpdates == null) {
Expand Down
4 changes: 4 additions & 0 deletions packages/sqlite_async/test/basic_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,10 @@ void main() {
);

await completion;
}, onPlatform: {
'browser': Skip(
'Web locks are managed with a shared worker, which does not support timeouts',
)
});
});
}
Expand Down