Skip to content

Commit 9567fea

Browse files
fixup! Fix missing request type in OnSystemRequest
1 parent e415fe4 commit 9567fea

File tree

3 files changed

+43
-31
lines changed

3 files changed

+43
-31
lines changed

app/controller/SettingsController.js

Lines changed: 40 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -332,13 +332,14 @@ SDL.SettingsController = Em.Object.create(
332332
* Method responsible for PolicyUpdate retry sequence
333333
* abort parameter if set to true means that retry sequence if finished
334334
*
335-
* @param {String} action
336335
* @param {Object} request_params
337336
*/
338-
policyUpdateRetry: function(action, request_params) {
339-
if(SDL.SDLModel.data.policyUpdateRetry.isIterationInProgress) {
337+
policyUpdateRetry: function(request_params) {
338+
if (SDL.SDLModel.data.policyUpdateRetry.isIterationInProgress) {
339+
Em.Logger.log('PTU retry: iteration is in progress');
340340
return;
341341
}
342+
342343
clearTimeout(SDL.SDLModel.data.policyUpdateRetry.timer);
343344
SDL.SDLModel.data.policyUpdateRetry.timer = null;
344345

@@ -358,7 +359,9 @@ SDL.SettingsController = Em.Object.create(
358359
params_to_send.appID
359360
);
360361
}
361-
if(!SDL.SDLModel.data.policyUpdateRetry.isRetry) {
362+
363+
if (!SDL.SDLModel.data.policyUpdateRetry.isRetry) {
364+
Em.Logger.log('PTU retry: starting retry sequence');
362365
SDL.SDLModel.data.policyUpdateRetry.isRetry = true;
363366
SDL.SDLModel.data.policyUpdateRetry.isIterationInProgress = true;
364367
SDL.SDLModel.data.policyUpdateRetry.timer = setTimeout(
@@ -368,33 +371,42 @@ SDL.SettingsController = Em.Object.create(
368371
);
369372
return;
370373
}
374+
371375
var length = SDL.SDLModel.data.policyUpdateRetry.retry.length;
372-
if(length == SDL.SDLModel.data.policyUpdateRetry.try) {
373-
SDL.SDLModel.data.policyUpdateRetry.isRetry = false;
374-
}
375-
if (action !== 'ABORT' && SDL.SDLModel.data.policyUpdateRetry.isRetry) {
376-
377-
SDL.SDLModel.data.policyUpdateRetry.oldTimer =
378-
SDL.SDLModel.data.policyUpdateRetry.retry[SDL.SDLModel.data.policyUpdateRetry.try] * 1000;
379-
380-
SDL.SDLModel.data.policyUpdateRetry.timer = setTimeout(
381-
function() {
382-
sendOnSystemRequest();
383-
}, SDL.SDLModel.data.policyUpdateRetry.oldTimer
384-
);
385-
SDL.SDLModel.data.policyUpdateRetry.isIterationInProgress = true;
386-
SDL.SDLModel.data.policyUpdateRetry.try++;
387-
} else {
376+
if (length == SDL.SDLModel.data.policyUpdateRetry.try) {
377+
Em.Logger.log('PTU retry: retry attempts are over');
388378
SDL.SDLModel.data.policyUpdateRetry.isRetry = false;
389-
clearTimeout(SDL.SDLModel.data.policyUpdateRetry.timer);
390-
SDL.SDLModel.data.policyUpdateRetry = {
391-
timeout: null,
392-
retry: [],
393-
try: null,
394-
timer: null,
395-
oldTimer: 0
396-
};
379+
return;
397380
}
381+
382+
SDL.SDLModel.data.policyUpdateRetry.oldTimer =
383+
SDL.SDLModel.data.policyUpdateRetry.retry[SDL.SDLModel.data.policyUpdateRetry.try] * 1000;
384+
385+
SDL.SDLModel.data.policyUpdateRetry.timer = setTimeout(
386+
function() {
387+
sendOnSystemRequest();
388+
}, SDL.SDLModel.data.policyUpdateRetry.oldTimer
389+
);
390+
391+
SDL.SDLModel.data.policyUpdateRetry.isIterationInProgress = true;
392+
SDL.SDLModel.data.policyUpdateRetry.try++;
393+
Em.Logger.log(`PTU retry: retry attempt #${SDL.SDLModel.data.policyUpdateRetry.try}`);
394+
},
395+
396+
/**
397+
* @description Aborts policy table update retry sequence
398+
*/
399+
policyUpdateAbort: function() {
400+
Em.Logger.log('PTU retry: retry sequence was aborted');
401+
SDL.SDLModel.data.policyUpdateRetry.isRetry = false;
402+
clearTimeout(SDL.SDLModel.data.policyUpdateRetry.timer);
403+
SDL.SDLModel.data.policyUpdateRetry = {
404+
timeout: null,
405+
retry: [],
406+
try: null,
407+
timer: null,
408+
oldTimer: 0
409+
};
398410
},
399411

400412
/**

ffw/BasicCommunicationRPC.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ FFW.BasicCommunication = FFW.RPCObserver
440440
messageCode = 'StatusUpToDate';
441441
//Update is complete, stop retry sequence
442442
if (FLAGS.ExternalPolicies === true) {
443-
SDL.SettingsController.policyUpdateRetry('ABORT');
443+
SDL.SettingsController.policyUpdateAbort();
444444
}
445445
SDL.SettingsController.policyUpdateFile = null;
446446
this.GetPolicyConfigurationData({
@@ -460,7 +460,7 @@ FFW.BasicCommunication = FFW.RPCObserver
460460
messageCode = 'StatusNeeded';
461461
if (FLAGS.ExternalPolicies === true &&
462462
SDL.SDLModel.data.policyUpdateRetry.isRetry) {
463-
SDL.SettingsController.policyUpdateRetry('RETRY');
463+
SDL.SettingsController.policyUpdateRetry(null);
464464
}
465465
break;
466466
}

ffw/ExternalPolicies.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ FFW.ExternalPolicies = Em.Object.create({
9090
onPackMessage: function(evt) {
9191
Em.Logger.log('ExternalPolicies onWSMessage ' + evt.data);
9292
this.packResponseReady = true;
93-
SDL.SettingsController.policyUpdateRetry('RETRY', this.sysReqParams);
93+
SDL.SettingsController.policyUpdateRetry(this.sysReqParams);
9494

9595
this.sysReqParams = {};
9696
},

0 commit comments

Comments
 (0)