Skip to content

Commit 0d44716

Browse files
committed
Rename to lockTimeout.
1 parent b8a68f9 commit 0d44716

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

lib/src/sqlite_open_factory.dart

+3-2
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@ class DefaultSqliteOpenFactory implements SqliteOpenFactory {
2929
List<String> pragmaStatements(SqliteOpenOptions options) {
3030
List<String> statements = [];
3131

32-
if (sqliteOptions.busyTimeout != null) {
32+
if (sqliteOptions.lockTimeout != null) {
33+
// May be replaced by a Dart-level retry mechanism in the future
3334
statements.add(
34-
'PRAGMA busy_timeout = ${sqliteOptions.busyTimeout!.inMilliseconds}');
35+
'PRAGMA busy_timeout = ${sqliteOptions.lockTimeout!.inMilliseconds}');
3536
}
3637

3738
if (options.primaryConnection && sqliteOptions.journalMode != null) {

lib/src/sqlite_options.dart

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,22 @@ class SqliteOptions {
1111
/// attempt to truncate the file afterwards.
1212
final int? journalSizeLimit;
1313

14-
/// Timeout waiting for locks to be released by other write connections.
14+
/// Timeout waiting for locks to be released by other connections.
1515
/// Defaults to 30 seconds.
16-
/// Set to 0 to fail immediately when the database is locked.
17-
final Duration? busyTimeout;
16+
/// Set to null or [Duration.zero] to fail immediately when the database is locked.
17+
final Duration? lockTimeout;
1818

1919
const SqliteOptions.defaults()
2020
: journalMode = SqliteJournalMode.wal,
2121
journalSizeLimit = 6 * 1024 * 1024, // 1.5x the default checkpoint size
2222
synchronous = SqliteSynchronous.normal,
23-
busyTimeout = const Duration(seconds: 30);
23+
lockTimeout = const Duration(seconds: 30);
2424

2525
const SqliteOptions(
2626
{this.journalMode = SqliteJournalMode.wal,
2727
this.journalSizeLimit = 6 * 1024 * 1024,
2828
this.synchronous = SqliteSynchronous.normal,
29-
this.busyTimeout = const Duration(seconds: 30)});
29+
this.lockTimeout = const Duration(seconds: 30)});
3030
}
3131

3232
/// SQLite journal mode. Set on the primary connection.

0 commit comments

Comments
 (0)