Skip to content

Commit

Permalink
Qos test fix (librenms#17050)
Browse files Browse the repository at this point in the history
* Only update QoS rates on the second poll

This stops the QoS rates from being calculated from the initial value of 0 on the first poll.  This was causing issues for testing, where over time the QoS rates would slowly reduce as the unix epoch counter increases

* Update all test data to have a rate of 0

* Fix - we need to check the original value

* Update all QoS rate test data from 0 to null

* More 0 to null fixes for test data
  • Loading branch information
eskyuu authored Jan 24, 2025
1 parent fea286d commit bf34be6
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 97 deletions.
2 changes: 1 addition & 1 deletion app/Observers/QosObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function updating(Qos $qos)
{
if ($qos->isDirty('last_polled')) {
$poll_interval = $qos->last_polled - $qos->getOriginal('last_polled');
if ($poll_interval > 0) {
if ($poll_interval > 0 && $qos->getOriginal('last_polled') > 0) {
$qos->bytes_out_rate = $this->calcRate($qos->last_bytes_out, $qos->getOriginal('last_bytes_out'), $poll_interval);
$qos->bytes_in_rate = $this->calcRate($qos->last_bytes_in, $qos->getOriginal('last_bytes_in'), $poll_interval);
$qos->bytes_drop_out_rate = $this->calcRate($qos->last_bytes_drop_out, $qos->getOriginal('last_bytes_drop_out'), $poll_interval);
Expand Down
Loading

0 comments on commit bf34be6

Please sign in to comment.