style: add flow-control braces to sync outbox
This commit is contained in:
parent
4402f1b272
commit
cf07bc6554
|
|
@ -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()));
|
||||
|
|
|
|||
Loading…
Reference in New Issue