[polari/join-room-list: 2/3] serverRoomManager: Limit time spend in idle more while filtering



commit 5962a84acf1080615e7448f6292879a3f74ce856
Author: Florian Müllner <fmuellner gnome org>
Date:   Mon Oct 23 18:15:17 2017 +0200

    serverRoomManager: Limit time spend in idle more while filtering
    
    With the previous commit, we now leave enough time each frame for
    drawing under normal circumstances. However as filtering requires
    some extra resources, we still run into responsiveness issues when
    the list is filtered while we are still loading it. Address this by
    limiting the time available for inserting rows some more while
    filtering is active.
    
    Fixes https://gitlab.gnome.org/GNOME/polari/issues/13

 src/serverRoomManager.js | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/src/serverRoomManager.js b/src/serverRoomManager.js
index a55f5ca..09706df 100644
--- a/src/serverRoomManager.js
+++ b/src/serverRoomManager.js
@@ -13,6 +13,7 @@ const Signals = imports.signals;
 const Utils = imports.utils;
 
 const MS_PER_IDLE = 10; // max time spend in idle
+const MS_PER_FILTER_IDLE = 5; // max time spend in idle while filtering
 
 let _singleton = null;
 
@@ -345,8 +346,10 @@ var ServerRoomList = new Lang.Class({
                                                      [checked, name, count, sensitive]);
                 store.move_before(iter, this._customRoomItem);
 
+                let maxTime = this._filterTerms.length > 0 ? MS_PER_FILTER_IDLE
+                                                           : MS_PER_IDLE;
                 // Limit time spent in idle to leave room for drawing etc.
-                if (GLib.get_monotonic_time() - startTime > 1000 * MS_PER_IDLE)
+                if (GLib.get_monotonic_time() - startTime > 1000 * maxTime)
                     return GLib.SOURCE_CONTINUE;
             }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]