[polari/wip/carlosg/tracker: 1/15] chatView: Request log entries on map
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/carlosg/tracker: 1/15] chatView: Request log entries on map
- Date: Sun, 24 Feb 2019 23:12:12 +0000 (UTC)
commit 367ff146924a4dc2b8224e1f498910a301b90798
Author: Carlos Garnacho <carlosg gnome org>
Date: Sun Feb 24 22:38:16 2019 +0100
chatView: Request log entries on map
If the number of rooms is high enough, querying log entries for all
chatViews at the same time is likely going to result in a bunch of
thread contention (since the DB interfaces are limited).
Make it query on map instead, which will likely be one at a time.
src/chatView.js | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/src/chatView.js b/src/chatView.js
index f604d0f..babd145 100644
--- a/src/chatView.js
+++ b/src/chatView.js
@@ -313,6 +313,16 @@ var ChatView = GObject.registerClass({
this._autoscroll = true;
});
+ this._queriedInitialBacklog = false;
+ this.connect('map', () => {
+ if (!this._queriedInitialBacklog) {
+ this._queriedInitialBacklog = true;
+ this._fetchingBacklog = true;
+ this._logWalker.getEvents(NUM_INITIAL_LOG_EVENTS,
+ this._onLogEventsReady.bind(this));
+ }
+ });
+
this.vadjustment.connect('value-changed',
this._onValueChanged.bind(this));
this.vadjustment.connect('changed', this._updateScroll.bind(this));
@@ -352,10 +362,6 @@ var ChatView = GObject.registerClass({
this._logWalker = new LogWalker(this._room);
- this._fetchingBacklog = true;
- this._logWalker.getEvents(NUM_INITIAL_LOG_EVENTS,
- this._onLogEventsReady.bind(this));
-
this._autoscroll = true;
this._app = Gio.Application.get_default();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]