add setting to enable eviction of discovered contacts in settings
This commit is contained in:
1 parent
98f6cf3745
commit
9db2307ea0
30 files changed
+260
-40
No files matched your search
@@ -1077,7 +1077,8 @@ class MeshCoreConnector extends ChangeNotifier {
|
||||
final cached = await _discoveryContactStore.loadContacts();
|
||||
// Trim a previously-saved oversized list down to the freshest entries so a
|
||||
// device that grew unbounded before the cap existed recovers on load.
|
||||
if (cached.length > _maxDiscoveredContacts) {
|
||||
if (_appSettingsService?.settings.evictDiscoveredContactsEnabled == true &&
|
||||
cached.length > _maxDiscoveredContacts) {
|
||||
cached.sort((a, b) => b.lastSeen.compareTo(a.lastSeen));
|
||||
cached.removeRange(_maxDiscoveredContacts, cached.length);
|
||||
unawaited(_discoveryContactStore.saveContacts(cached));
|
||||
@@ -7201,7 +7202,8 @@ class MeshCoreConnector extends ChangeNotifier {
|
||||
flags: 0,
|
||||
);
|
||||
|
||||
if (_discoveredContacts.length >= _maxDiscoveredContacts) {
|
||||
if (_appSettingsService?.settings.evictDiscoveredContactsEnabled == true &&
|
||||
_discoveredContacts.length >= _maxDiscoveredContacts) {
|
||||
_evictStalestDiscoveredContact();
|
||||
}
|
||||
_discoveredContacts.add(disContact);
|
||||
|
||||
Reference in new issue
Block a user