Changeset acea570 for src


Ignore:
Timestamp:
Apr 23, 2017, 5:34:25 PM (10 years ago)
Author:
Joachim Langenbach <joachim.langenbach@…>
Branches:
0.5, app-cordova, debian/bullseye, debian/jessie, master
Children:
08bb037
Parents:
c61b79b
Message:

Tried to improve performance of rrd data parsing and raised the polling intervall from webclient

Location:
src/webapp
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/webapp/webclient/javascript/main.js

    rc61b79b racea570  
    122122$(document).ready(function() {
    123123        displayDataGet();
    124         setInterval(displayDataGet, 5000);
     124        setInterval(displayDataGet, 15000);
    125125       
    126126        $.getJSON("../webservice/tileserver.php?/map.json", mapSetup);
  • src/webapp/webservice/index.php

    rc61b79b racea570  
    1616    along with this program.  If not, see <http://www.gnu.org/licenses/>.
    1717*/
     18
     19xdebug_start_trace();
    1820
    1921require_once(__DIR__ ."/inc/Config.php");
    … …  
    6365        $lastTime = -1;
    6466        $keys = array_keys($data);
    65         if(count($keys) < 0 ){
     67        $keyTimeframes = $keys[0];
     68        $itemCount = count($keys);
     69        if($itemCount < 0 ){
    6670                error_log("No keys in fetched rrd data from ". $dbFile);
    6771                echo json_encode("");
    6872                exit;
    6973        }
     74        $timeframesCount = count($data[$keyTimeframes]);
    7075        if($debug > 0){
    71                 echo "<p>Variables: ". count($keys) ."; Timeframes: ". count($data[$keys[0]]) ."</p>\n";
     76                echo "<p>Variables: ". $itemCount ."; Timeframes: ". $timeframesCount ."</p>\n";
    7277        }
    73         for($i = 0; $i < count($data[$keys[0]]); $i++){
    74                 $time = array_keys($data[$keys[0]])[$i];
     78        $keysTimeframes = array_keys($data[$keyTimeframes]);
     79        for($i = 0; $i < $timeframesCount; $i++){
     80                $time = $keysTimeframes[$i];
    7581                $allValid = true;
    7682                $tmp = array();
    … …  
    175181}
    176182
     183xdebug_stop_trace();
     184
    177185?>
Note: See TracChangeset for help on using the changeset viewer.