Details
-
Type: Improvement
-
Status: Done/Fixed
-
Priority: Trivial
-
Resolution: Fixed/Completed
-
Affects Version/s: 3.2.3
-
Fix Version/s: 3.3.alpha
-
Component/s: Core CiviCRM
-
Labels:None
Description
As noted in the last paragraph of the bug report for CRM-6407, why is that bin/ContributionProcessor.php does a TransactionSearch for a date range and then iterates over every single one (possibly up to 100 records) with GetTransactionDetails, before bothering to check if trxn_id already exists in the database? Most people will probably be running ContributionProcessor.php from a cron job, and probably even on a daily basis. This means that most transaction will probably have already been recorded, and running GetTransactionDetails is a waste of time because the contribution will be rejected as already existing in the database. The results of TransactionSearch include the transaction id, so we can obviate the need to make the expensive remote call to GetTransactionDetails for a given transaction if we just check whether it already exists in the database before running GetTransactionDetails. Doing this will reduce network traffic and greatly speed up the runtime of the script.