Let entry cap remove spent outgoing images; clarify channel row arrival ordering
Outgoing image entries were excluded from the maxEntries cap, and age eviction only marks them evicted, so frequent senders accumulated entries and sidecars without bound. Outgoing entries with nothing left on disk (or failed) are now eligible, oldest first. Rename _ChannelChatRow.timestamp to receivedAt: it already returned the local arrival time used for sorting and day separators.
This commit is contained in:
1 parent
25f197c979
commit
616c433922
3 files changed
+45
-8
No files matched your search
@@ -1556,7 +1556,8 @@ class ReceivedImageStore extends ChangeNotifier {
|
||||
|
||||
/// Brings the entry count inside [maxEntries], oldest first: failures, then
|
||||
/// entries with nothing left on disk, then undecoded incoming images. Never
|
||||
/// touches outgoing images, a running decode or a stream still receiving.
|
||||
/// touches an outgoing image that still has data on disk, a running decode
|
||||
/// or a stream still receiving.
|
||||
Future<List<String>> _enforceEntryCap({String? protect}) async {
|
||||
final removed = <String>[];
|
||||
if (_entries.length <= maxEntries) return removed;
|
||||
@@ -1573,7 +1574,14 @@ class ReceivedImageStore extends ChangeNotifier {
|
||||
.where(
|
||||
(e) =>
|
||||
e.streamId != protect &&
|
||||
!e.isOutgoing &&
|
||||
// An outgoing image may go once nothing of it is left on
|
||||
// disk (age eviction only marks it evicted), or it failed;
|
||||
// otherwise frequent senders grow sidecars without bound.
|
||||
(!e.isOutgoing ||
|
||||
e.state.isFailure ||
|
||||
(e.state == ReceivedImageState.evicted &&
|
||||
!e.pngStored &&
|
||||
!e.bitstreamStored)) &&
|
||||
(e.state.isFailure ||
|
||||
e.state == ReceivedImageState.evicted ||
|
||||
e.state == ReceivedImageState.reassembled ||
|
||||
|
||||
Reference in new issue
Block a user