force a contact sort every 29sec (when available)
Some checks are pending
ContinuousDelivery / linux-ubuntu (push) Waiting to run
ContinuousDelivery / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android]) (push) Waiting to run
ContinuousDelivery / android (map[ndk_abi:armeabi-v7a vcpkg_toolkit:arm-neon-android]) (push) Waiting to run
ContinuousDelivery / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android]) (push) Waiting to run
ContinuousDelivery / windows (push) Waiting to run
ContinuousDelivery / windows-asan (push) Waiting to run
ContinuousDelivery / dumpsyms (push) Blocked by required conditions
ContinuousDelivery / release (push) Blocked by required conditions
ContinuousIntegration / linux (push) Waiting to run
ContinuousIntegration / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android]) (push) Waiting to run
ContinuousIntegration / android (map[ndk_abi:armeabi-v7a vcpkg_toolkit:arm-neon-android]) (push) Waiting to run
ContinuousIntegration / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android]) (push) Waiting to run
ContinuousIntegration / macos (push) Waiting to run
ContinuousIntegration / windows (push) Waiting to run

this is mostly because we dont throw events on new messages for contacts
This commit is contained in:
Green Sky 2025-03-24 12:28:03 +01:00
parent 7420c3f80d
commit 528e312f25
No known key found for this signature in database
GPG Key ID: DBE05085D874AB4A
2 changed files with 6 additions and 2 deletions

View File

@ -2,6 +2,8 @@
#include <solanaceae/contact/components.hpp>
#include <solanaceae/util/time.hpp>
ContactListSorter::comperator_fn ContactListSorter::getSortGroupsOverPrivates(void) {
return [](const ContactRegistry4& cr, const Contact4 lhs, const Contact4 rhs) -> std::optional<bool> {
@ -97,8 +99,8 @@ ContactListSorter::~ContactListSorter(void) {
}
void ContactListSorter::sort(void) {
// TODO: timer
if (!_dirty) {
const uint64_t now = getTimeMS();
if ((now > _last_sort && now - _last_sort < 1000*29) && !_dirty) {
return;
}
@ -119,6 +121,7 @@ void ContactListSorter::sort(void) {
entt::insertion_sort{} // o(n) in >90% of cases
);
_last_sort = now;
_dirty = false;
}

View File

@ -30,6 +30,7 @@ class ContactListSorter : public ContactStore4EventI {
ContactStore4I::SubscriptionReference _cs_sr;
std::vector<comperator_fn> _sort_stack;
uint64_t _last_sort {0};
bool _dirty {true};
// TODO: timer, to guarantie a sort ever X seconds?
// (turns out we dont throw on new messages <.<)