[pve-devel] applied: [PATCH] LogView: also reduce log syscall on scrolling
Thomas Lamprecht
t.lamprecht at proxmox.com
Tue May 7 17:17:25 CEST 2019
move the "return early, because a request is already pending" into
the doLoad function, so that all calls to it underly the request
limiting, but note that such a new request is desired, and if so
schedule it once the current finishes. This ensures that scrolling
will always get honored, but does not produces multiple hanging
workers, at max one.
Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
applied as follow up to:
https://pve.proxmox.com/pipermail/pve-devel/2019-April/036790.html
panel/LogView.js | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/panel/LogView.js b/panel/LogView.js
index aae7440..f5c9dd8 100644
--- a/panel/LogView.js
+++ b/panel/LogView.js
@@ -73,6 +73,10 @@ Ext.define('Proxmox.panel.LogView', {
doLoad: function() {
var me = this;
+ if (me.running) {
+ me.requested = true;
+ return;
+ }
me.running = true;
var view = me.getView();
var viewModel = me.getViewModel();
@@ -96,6 +100,10 @@ Ext.define('Proxmox.panel.LogView', {
lines.length = total;
me.updateView(lines.join('<br>'), first - 1, total);
me.running = false;
+ if (me.requested) {
+ me.requested = false;
+ view.loadTask.delay(200);
+ }
},
failure: function(response) {
if (view.failCallback) {
@@ -105,6 +113,10 @@ Ext.define('Proxmox.panel.LogView', {
Proxmox.Utils.setErrorMask(me, msg);
}
me.running = false;
+ if (me.requested) {
+ me.requested = false;
+ view.loadTask.delay(200);
+ }
}
});
},
@@ -156,9 +168,7 @@ Ext.define('Proxmox.panel.LogView', {
}
if (me.scrollPosBottom() <= 1) {
- if (!me.running) {
- view.loadTask.delay(200);
- }
+ view.loadTask.delay(200);
}
},
interval: 1000
--
2.20.1
More information about the pve-devel
mailing list