[freeside-commits] freeside/FS/FS cust_main.pm,1.302,1.303

Jason Hall jayce at wavetail.420.am
Thu Sep 27 17:33:18 PDT 2007


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail:/tmp/cvs-serv21773

Modified Files:
	cust_main.pm 
Log Message:
Fixes a bug where retry_realtime isn't limiting to that user's events, therefore selecting all retryable events, and having to filter later.  On a system with a running history, this caused bad O() types of situations for performance, especially bad when this was called by something that a user would be awaiting feedback from


Index: cust_main.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_main.pm,v
retrieving revision 1.302
retrieving revision 1.303
diff -u -d -r1.302 -r1.303
--- cust_main.pm	27 Sep 2007 18:24:32 -0000	1.302
+++ cust_main.pm	28 Sep 2007 00:33:16 -0000	1.303
@@ -2731,6 +2731,13 @@
 
   my $join = FS::part_event_condition->join_conditions_sql;
   my $order = FS::part_event_condition->order_conditions_sql;
+  my $mine = 
+  '( '
+   . join ( ' OR ' , map { 
+    "( part_event.eventtable = " . dbh->quote($_) 
+    . " AND tablenum IN( SELECT " . dbdef->table($_)->primary_key . " from $_ where custnum = " . dbh->quote( $self->custnum ) . "))" ;
+   } FS::part_event->eventtables)
+   . ') ';
 
   #here is the agent virtualization
   my $agent_virt = " (    part_event.agentnum IS NULL
@@ -2754,7 +2761,7 @@
     'addl_from' => "LEFT JOIN part_event USING ( eventpart ) $join",
     'hashref'   => { 'status' => 'done' },
     'extra_sql' => " AND statustext IS NOT NULL AND statustext != '' ".
-                   " AND $is_realtime_event AND $agent_virt $order" # LIMIT 1"
+                   " AND $mine AND $is_realtime_event AND $agent_virt $order" # LIMIT 1"
   });
 
   my %seen_invnum = ();



More information about the freeside-commits mailing list