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
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:
parent
7420c3f80d
commit
528e312f25
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
#include <solanaceae/contact/components.hpp>
|
#include <solanaceae/contact/components.hpp>
|
||||||
|
|
||||||
|
#include <solanaceae/util/time.hpp>
|
||||||
|
|
||||||
ContactListSorter::comperator_fn ContactListSorter::getSortGroupsOverPrivates(void) {
|
ContactListSorter::comperator_fn ContactListSorter::getSortGroupsOverPrivates(void) {
|
||||||
return [](const ContactRegistry4& cr, const Contact4 lhs, const Contact4 rhs) -> std::optional<bool> {
|
return [](const ContactRegistry4& cr, const Contact4 lhs, const Contact4 rhs) -> std::optional<bool> {
|
||||||
|
|
||||||
@ -97,8 +99,8 @@ ContactListSorter::~ContactListSorter(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ContactListSorter::sort(void) {
|
void ContactListSorter::sort(void) {
|
||||||
// TODO: timer
|
const uint64_t now = getTimeMS();
|
||||||
if (!_dirty) {
|
if ((now > _last_sort && now - _last_sort < 1000*29) && !_dirty) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,6 +121,7 @@ void ContactListSorter::sort(void) {
|
|||||||
entt::insertion_sort{} // o(n) in >90% of cases
|
entt::insertion_sort{} // o(n) in >90% of cases
|
||||||
);
|
);
|
||||||
|
|
||||||
|
_last_sort = now;
|
||||||
_dirty = false;
|
_dirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ class ContactListSorter : public ContactStore4EventI {
|
|||||||
ContactStore4I::SubscriptionReference _cs_sr;
|
ContactStore4I::SubscriptionReference _cs_sr;
|
||||||
std::vector<comperator_fn> _sort_stack;
|
std::vector<comperator_fn> _sort_stack;
|
||||||
|
|
||||||
|
uint64_t _last_sort {0};
|
||||||
bool _dirty {true};
|
bool _dirty {true};
|
||||||
// TODO: timer, to guarantie a sort ever X seconds?
|
// TODO: timer, to guarantie a sort ever X seconds?
|
||||||
// (turns out we dont throw on new messages <.<)
|
// (turns out we dont throw on new messages <.<)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user