[polari/wip/fmuellner/tracker: 89/90] chatView: Postpone fetching backlog until mapped
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/fmuellner/tracker: 89/90] chatView: Postpone fetching backlog until mapped
- Date: Tue, 30 Aug 2016 22:05:17 +0000 (UTC)
commit 88dbc86e3e312eb8533f526e94781c0e23b2aeee
Author: Florian Müllner <fmuellner gnome org>
Date: Fri May 20 23:54:23 2016 +0200
chatView: Postpone fetching backlog until mapped
Tracker (or more precisely: threading restrictions imposed by the
underlying sqlite database) becomes a bottleneck when running too
many queries simultaneously. Depending on the number of channels,
this can be quite noticeable when fetching backlogs for all channels
on startup. Avoid this by only fetching the initial backlog when
mapping the chat log for the first time.
src/chatView.js | 21 ++++++++++++++-------
1 files changed, 14 insertions(+), 7 deletions(-)
---
diff --git a/src/chatView.js b/src/chatView.js
index bd1776e..e7ee049 100644
--- a/src/chatView.js
+++ b/src/chatView.js
@@ -284,6 +284,7 @@ const ChatView = new Lang.Class({
this._room = room;
this._state = { lastNick: null, lastTimestamp: 0, lastStatusGroup: 0 };
+ this._fetchingBacklog = false;
this._joinTime = 0;
this._maxNickChars = MAX_NICK_CHARS;
this._hoveredButtonTags = [];
@@ -292,6 +293,7 @@ const ChatView = new Lang.Class({
this._pendingLogs = [];
this._initialPending = [];
this._statusCount = { left: 0, joined: 0, total: 0 };
+ this._logWalker = null;
this._room.account.connect('notify::nickname', Lang.bind(this,
function() {
@@ -299,13 +301,6 @@ const ChatView = new Lang.Class({
}));
this._updateMaxNickChars(this._room.account.nickname.length);
- let logManager = LogManager.getDefault();
- this._logWalker = logManager.walkEvents(room);
-
- this._fetchingBacklog = true;
- this._logWalker.getEvents(NUM_INITIAL_LOG_EVENTS,
- Lang.bind(this, this._onLogEventsReady));
-
this._autoscroll = true;
this._app = Gio.Application.get_default();
@@ -591,6 +586,18 @@ const ChatView = new Lang.Class({
this._view.left_margin = MARGIN + totalWidth;
},
+ _ensureLogWalker: function() {
+ if (this._logWalker)
+ return;
+
+ let logManager = LogManager.getDefault();
+ this._logWalker = logManager.walkEvents(this._room);
+
+ this._fetchingBacklog = true;
+ this._logWalker.getEvents(NUM_INITIAL_LOG_EVENTS,
+ Lang.bind(this, this._onLogEventsReady));
+ },
+
_updateScroll: function() {
if (!this._autoscroll)
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]