perf(transactions): resolve the override handler once for bulk updates
bulkUpdate() re-resolved CategoryOverrideHandler from the container on every iteration of the transaction loop. Resolve it once before the loop — cheaper, and it lets the handler's AiRuleLearner memoize per-user work across the batch (see follow-up).
This commit is contained in:
parent
ad46e465be
commit
7b13214e07
|
|
@ -313,8 +313,10 @@ class TransactionController extends Controller
|
|||
if ($request->has('category_id')) {
|
||||
$newCategoryId = $request->input('category_id');
|
||||
|
||||
$overrideHandler = app(CategoryOverrideHandler::class);
|
||||
|
||||
foreach ($transactions as $transaction) {
|
||||
app(CategoryOverrideHandler::class)->record($transaction, $newCategoryId);
|
||||
$overrideHandler->record($transaction, $newCategoryId);
|
||||
}
|
||||
|
||||
$updateData['category_id'] = $newCategoryId;
|
||||
|
|
|
|||
Loading…
Reference in New Issue