Ignore:
Timestamp:
Oct 25, 2017, 10:55:05 PM (7 years ago)
Author:
chronos
Message:
  • Modified: Use better transaction mechanism for netwatch import and latency measurement.
  • Fixed: Query duration mesurement using outdated microtime result.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/NetworkConfigLinux/Generators/Latency.php

    r842 r852  
    2222    exec('fping -e -r '.$RetryLimit.' -t '.$Timeout.' -a '.implode(' ', $Hosts).' 2>/dev/null', $Output);
    2323
    24     $this->Database->query('BEGIN');
    25     foreach($Output as $Index => $Line) {
     24    $Queries = array();
     25    foreach($Output as $Index => $Line)
     26    {
    2627      $IP = substr($Line, 0, strPos($Line, ' '));
    2728      $Line = substr($Line, strpos($Line, '(') + 1);
    2829      $Value = substr($Line, 0, strpos($Line, ' '));
    2930      //echo($IP.' '.$Value."\n");
    30       $this->Database->insert('NetworkInterfaceLatency', array('Interface' => $HostInterface[$IP],
     31      $Queries[] = $this->Database->GetInsert('NetworkInterfaceLatency', array('Interface' => $HostInterface[$IP],
    3132        'Value' => $Value, 'Time' => TimeToMysqlDateTime($Time)));
    3233    }
    33     $this->Database->query('COMMIT');
     34    $this->Database->Transaction($Queries);
    3435  }
    3536
Note: See TracChangeset for help on using the changeset viewer.