[pve-devel] [PATCH manager] fix surviving update store

Dominik Csapak d.csapak at proxmox.com
Mon Jul 4 13:16:10 CEST 2016


when a load of an update store was ongoing and stopUpdate
was called, the task could not be canceled, and the store
would remain indefinitely

this patch sets 'isStopped' of the store on stopUpdate
and checks it on the next update and stopping it then

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/data/UpdateStore.js | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/www/manager6/data/UpdateStore.js b/www/manager6/data/UpdateStore.js
index 7208a4f..6be3630 100644
--- a/www/manager6/data/UpdateStore.js
+++ b/www/manager6/data/UpdateStore.js
@@ -10,6 +10,8 @@
 Ext.define('PVE.data.UpdateStore', {
     extend: 'Ext.data.Store',
 
+    isStopped: true,
+
     constructor: function(config) {
 	var me = this;
 
@@ -26,6 +28,10 @@ Ext.define('PVE.data.UpdateStore', {
 	var load_task = new Ext.util.DelayedTask();
 
 	var run_load_task = function() {
+	    if (me.isStopped) {
+		return;
+	    }
+
 	    if (PVE.Utils.authOK()) {
 		PVE.data.UpdateQueue.queue(me, function(runtime, success) {
 		    var interval = config.interval + runtime*2;
@@ -38,9 +44,11 @@ Ext.define('PVE.data.UpdateStore', {
 
 	Ext.apply(config, {
 	    startUpdate: function() {
+		me.isStopped = false;
 		run_load_task();
 	    },
 	    stopUpdate: function() {
+		me.isStopped = true;
 		load_task.cancel();
 		PVE.data.UpdateQueue.unqueue(me);
 	    }
-- 
2.1.4




More information about the pve-devel mailing list