diff options
| author | Marvin W <git@larma.de> | 2023-03-20 15:40:44 -0600 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi92@disroot.org> | 2026-02-10 23:40:46 +0100 |
| commit | 3769d06940e6cf68f0f9ecafb4c275cf33944ea2 (patch) | |
| tree | f63baea6c01bde6a771b1dde23108562c4f4a645 /main/src | |
| parent | a859694a64ec3e5481e8f5051187587ecd4c3ebf (diff) | |
| download | dino-3769d06940e6cf68f0f9ecafb4c275cf33944ea2.tar.gz | |
Improve database performance while reconnecting and syncing
Also move some tasks to low priority idle queue so they won't block UI updates
Diffstat (limited to 'main/src')
| -rw-r--r-- | main/src/ui/conversation_selector/conversation_selector_row.vala | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/main/src/ui/conversation_selector/conversation_selector_row.vala b/main/src/ui/conversation_selector/conversation_selector_row.vala index e71f58d1..b526e11e 100644 --- a/main/src/ui/conversation_selector/conversation_selector_row.vala +++ b/main/src/ui/conversation_selector/conversation_selector_row.vala @@ -218,7 +218,21 @@ public class ConversationSelectorRow : ListBoxRow { label.attributes = copy; } + private bool update_read_pending = false; + private bool update_read_pending_force = false; protected void update_read(bool force_update = false) { + if (force_update) update_read_pending_force = true; + if (update_read_pending) return; + update_read_pending = true; + Idle.add(() => { + update_read_pending = false; + update_read_pending_force = false; + update_read_idle(update_read_pending_force); + return Source.REMOVE; + }, Priority.LOW); + } + + private void update_read_idle(bool force_update = false) { int current_num_unread = stream_interactor.get_module(ChatInteraction.IDENTITY).get_num_unread(conversation); if (num_unread == current_num_unread && !force_update) return; num_unread = current_num_unread; |
