Skip to content

Commit

Permalink
- Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
exodus4d committed Dec 6, 2019
1 parent 1880a2f commit f9d5860
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 14 deletions.
8 changes: 8 additions & 0 deletions app/main/model/pathfinder/cronmodel.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ protected function logState(){
$this->lastExecMemPeak = null;
}

/**
* @param bool $addLastIfFinished
* @return array
*/
protected function getHistory(bool $addLastIfFinished = false) : array {
$history = $this->history ? : [];

Expand Down Expand Up @@ -214,6 +218,10 @@ protected function inExec() : bool {
return $this->lastExecStart && !$this->lastExecEnd;
}

/**
* @return bool
* @throws \Exception
*/
protected function isTimedOut() : bool {
$timedOut = false;
if($this->lastExecStart){
Expand Down
8 changes: 4 additions & 4 deletions js/app/lib/cron.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ define([
Example1 run task every second ------------------------------------------------------------------------------------
let task1 = Cron.new('task1', {precision: 'seconds', interval: 1, timeout: 100});
task1.task = (timer) => {
console.log('task1 function():', timer.getTotalTimeValues());
console.info('task1 function():', timer.getTotalTimeValues());
return 'OK';
};
Cron.set(task1);
Example2 run task every 3 seconds ---------------------------------------------------------------------------------
let task1 = Cron.new('task1', {precision: 'seconds', interval: 3, timeout: 100});
task1.task = (timer) => {
console.log('task1 function():', timer.getTotalTimeValues());
console.info('task1 function():', timer.getTotalTimeValues());
return 'OK';
};
Cron.set(task1);
Expand All @@ -25,12 +25,12 @@ define([
let task1 = Cron.new('task1', {precision: 'seconds', interval: 1, timeout: 100});
task1.task = (timer, task) => {
return new Promise((resolve, reject) => {
console.log('task1 Promise1():', timer.getTotalTimeValues(), task.get('interval'));
console.info('task1 Promise1():', timer.getTotalTimeValues(), task.get('interval'));
//task.set('interval', task.get('interval') + 1) // increase run interval every time by 1s
resolve('OK1');
}).then(payload => {
return new Promise((resolve, reject) => {
console.log('task2 Promise2():', timer.getTotalTimeValues(), payload);
console.info('task2 Promise2():', timer.getTotalTimeValues(), payload);
resolve('OK2');
});
});
Expand Down
8 changes: 4 additions & 4 deletions public/js/v1.5.5/app/lib/cron.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ define([
Example1 run task every second ------------------------------------------------------------------------------------
let task1 = Cron.new('task1', {precision: 'seconds', interval: 1, timeout: 100});
task1.task = (timer) => {
console.log('task1 function():', timer.getTotalTimeValues());
console.info('task1 function():', timer.getTotalTimeValues());
return 'OK';
};
Cron.set(task1);
Example2 run task every 3 seconds ---------------------------------------------------------------------------------
let task1 = Cron.new('task1', {precision: 'seconds', interval: 3, timeout: 100});
task1.task = (timer) => {
console.log('task1 function():', timer.getTotalTimeValues());
console.info('task1 function():', timer.getTotalTimeValues());
return 'OK';
};
Cron.set(task1);
Expand All @@ -25,12 +25,12 @@ define([
let task1 = Cron.new('task1', {precision: 'seconds', interval: 1, timeout: 100});
task1.task = (timer, task) => {
return new Promise((resolve, reject) => {
console.log('task1 Promise1():', timer.getTotalTimeValues(), task.get('interval'));
console.info('task1 Promise1():', timer.getTotalTimeValues(), task.get('interval'));
//task.set('interval', task.get('interval') + 1) // increase run interval every time by 1s
resolve('OK1');
}).then(payload => {
return new Promise((resolve, reject) => {
console.log('task2 Promise2():', timer.getTotalTimeValues(), payload);
console.info('task2 Promise2():', timer.getTotalTimeValues(), payload);
resolve('OK2');
});
});
Expand Down
2 changes: 1 addition & 1 deletion public/templates/ui/info_panel.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div id="{{id}}" class="alert alert-warning">
<div class="ui-pnotify-icon"><span class="fas fa-exclamation fa-fw fa-lg"></span></div>
<h4 class="ui-pnotify-title">Scheduled maintenance: Update v1.5.3 <i class="fas fa-long-arrow-alt-right"></i> v1.5.4; Shutdown: ~16:00 (UTC). ETA ~17:00 (UTC)</h4>
<h4 class="ui-pnotify-title">Scheduled maintenance: Update v1.5.4 <i class="fas fa-long-arrow-alt-right"></i> v1.5.5; Shutdown: ~16:00 (UTC). ETA ~17:00 (UTC)</h4>
</div>
10 changes: 5 additions & 5 deletions public/templates/ui/notice.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ <h3 class="panel-title">New release {{version}}</h3>

<div class="price-features text-left" style="min-height: inherit;">
<div class="row">
<div class="col-sm-6">
<div class="col-sm-5">
<ul class="list-unstyled text-left">
<li><i class="fas fa-fw fa-angle-right"></i>Data for NPC stations added <a target="_blank" href="//github.com/exodus4d/pathfinder/issues/858" rel="noopener">#858</a></li>
<li><i class="fas fa-fw fa-angle-right"></i>"Sovereignty" and "Faction warfare" data added <a target="_blank" href="//github.com/exodus4d/pathfinder/issues/853" rel="noopener">#853</a></li>
<li><i class="fas fa-fw fa-angle-right"></i>Bulk update for "Structures" <a target="_blank" href="//github.com/exodus4d/pathfinder/issues/869" rel="noopener">#869</a></li>
<li><i class="fas fa-fw fa-angle-right"></i>Switched to new image server <a target="_blank" href="//github.com/exodus4d/pathfinder/issues/872" rel="noopener">#872</a></li>
</ul>
</div>
<div class="col-sm-6">
<div class="col-sm-7">
<ul class="list-unstyled text-left">
<li><i class="fas fa-fw fa-angle-right"></i>New preview for "signature table" updates <a target="_blank" href="//github.com/exodus4d/pathfinder/issues/803" rel="noopener">#803</a></li>
<li><i class="fas fa-fw fa-angle-right"></i>Improved signature types for "Shattered wormholes" <a target="_blank" href="//github.com/exodus4d/pathfinder/issues/875" rel="noopener">#875</a></li>
<li><i class="fas fa-fw fa-angle-double-right"></i>Many more improvements/fixes. Complete <a href="javascript:void(0)" class="pf-navbar-version-info">changelog</a></li>
</ul>
</div>
Expand Down

0 comments on commit f9d5860

Please sign in to comment.