Skip to content

Commit 56ba7b5

Browse files
committed
test: simplify db concurrency test writes
1 parent 6d3b5e1 commit 56ba7b5

1 file changed

Lines changed: 2 additions & 13 deletions

File tree

integration_test/database_concurrency_test.dart

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ Future<void> _executeConcurrencyTest(
9797
ConcurrencyWorkerArgs(dbPath: dbPath, dbName: dbName, itemsToWrite: bgCount),
9898
);
9999
// Perform UI Writes
100-
final uiFuture = _runMainWrites(mainRepository, uiCount);
100+
final uiFuture = _performBatchWrites(mainRepository, count: uiCount);
101101

102102
final bgSuccess = await bgFuture;
103103
final uiSuccess = await uiFuture;
@@ -109,15 +109,6 @@ Future<void> _executeConcurrencyTest(
109109
expect(logs.length, equals(bgCount + uiCount), reason: 'Total DB rows mismatch');
110110
}
111111

112-
/// Helper wrapper to execute writes on the Main Isolate with error handling.
113-
Future<int> _runMainWrites(CallLogsRepository repository, int count) async {
114-
try {
115-
return await _performBatchWrites(repository, count: count);
116-
} catch (e) {
117-
fail('UI Write failed: $e');
118-
}
119-
}
120-
121112
/// Entry point for the background isolate.
122113
///
123114
/// Establishes an independent DB connection and executes the write batch.
@@ -145,9 +136,7 @@ Future<int> _performBatchWrites(CallLogsRepository repository, {required int cou
145136
await repository.add(call);
146137
successCount++;
147138

148-
if (count > 0) {
149-
await Future.delayed(Duration(milliseconds: random.nextInt(5)));
150-
}
139+
await Future.delayed(Duration(milliseconds: random.nextInt(5)));
151140
}
152141
return successCount;
153142
}

0 commit comments

Comments
 (0)