Author: spadkins
Date: Tue Jan 22 09:38:43 2008
New Revision: 10639

Modified:
   p5ee/trunk/App-Context/lib/App/Context/POE/Server.pm

Log:
bug fixes to the load estimation in finish_async_event

Modified: p5ee/trunk/App-Context/lib/App/Context/POE/Server.pm
==============================================================================
--- p5ee/trunk/App-Context/lib/App/Context/POE/Server.pm        (original)
+++ p5ee/trunk/App-Context/lib/App/Context/POE/Server.pm        Tue Jan 22 
09:38:43 2008
@@ -1106,11 +1106,13 @@
         my $destination = $event->{destination} || "local";
         ### Decrease the node's load value a fraction of its last system load
         my $system_load = $self->{node}{$destination}{system_load};
+        my $load = $self->{node}{$destination}{load};
         my $number_node_events = $self->{node}{$destination}{num_async_events};
+        my $load_decrease_amount = 0;
         if ($number_node_events > 0) {
-            my $load_decrease_amount = $system_load / $number_node_events;
-            $self->{node}{$destination}{load} -= $load_decrease_amount;
+            $load_decrease_amount = $load / $number_node_events;
         }
+        $self->{node}{$destination}{load} = sprintf("%.1f", $load - 
$load_decrease_amount);
         ### Keep track of our event counts
         $self->{num_async_events}--;
         $self->{node}{$destination}{num_async_events}--;

Reply via email to