Fine generator recycles cstore drones
authorBill Erickson <berickxx@gmail.com>
Tue, 18 Jul 2017 14:59:04 +0000 (10:59 -0400)
committerBill Erickson <berickxx@gmail.com>
Wed, 19 Jul 2017 15:02:27 +0000 (11:02 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/CircCommon.pm

index 3d23154..ed58009 100644 (file)
@@ -505,9 +505,13 @@ sub generate_fines {
 
         eval {
 
-            # Clean up after previous transaction.  
-            # This is a no-op if there is no open transaction.
-            $e->xact_rollback if $commit;
+            # Clean up after previous transaction and disconnect from
+            # cstore drone.  Forcing a disconnect helps prevent memory
+            # exhaustion when processing huge batches of transactions.
+            # Note the disconnect is forced here instead of during
+            # $e->xact_commit to ensure a disconnect happens with every
+            # transaction regardless of whether a billing was created.
+            $e->rollback if $commit;
 
             $logger->info(sprintf("Processing $ctype %d...", $c->id));