style: add flow-control braces to sync outbox

This commit is contained in:
bponders12-cell 2026-09-01 17:34:29 -04:00
parent 4402f1b272
commit cf07bc6554
1 changed files with 3 additions and 1 deletions

View File

@ -41,7 +41,9 @@ class SyncOutbox {
final operation = _saveChain.then((_) async {
if (_items.length > maxOutboxCapacity) {
final terminal = _items.values.where((i) => i.status.isTerminal).toList()..sort((a, b) => a.createdAt.compareTo(b.createdAt));
while (_items.length > maxOutboxCapacity && terminal.isNotEmpty) _items.remove(terminal.removeAt(0).key);
while (_items.length > maxOutboxCapacity && terminal.isNotEmpty) {
_items.remove(terminal.removeAt(0).key);
}
}
if (_items.length > maxOutboxCapacity) throw StateError('Sync outbox capacity reached with no evictable terminal items.');
return _prefs.setString(_outboxStorageKey, jsonEncode(_items.values.map((e) => e.toJson()).toList()));