From 70876a48e281fe03524c83ff8aaa0d7c30ab19d4 Mon Sep 17 00:00:00 2001 From: VivianDee <115420678+VivianDee@users.noreply.github.com> Date: Tue, 11 Nov 2025 07:06:01 +0100 Subject: [PATCH] Update autocall.py --- app/routes/autocall.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/app/routes/autocall.py b/app/routes/autocall.py index 1f8d50e..8dc07fa 100644 --- a/app/routes/autocall.py +++ b/app/routes/autocall.py @@ -1,3 +1,4 @@ +from threading import Thread from flask import Blueprint, request, jsonify, current_app import requests from app.extensions import db @@ -194,8 +195,16 @@ def direct_loan(): "productId": str(loan_data.get('productId', "")), "provideAmount": loan_data.get('currentLoanAmount'), } - response = SimbrellaClient.disburse_loan(data_to_process) - return response + + + logger.info(f"Starting disbursement thread for {data_to_process['transactionId']}") + thread = Thread(target=SimbrellaClient.disburse_loan, args=(data_to_process,)) + thread.start() + + return jsonify({ + "status": "success", + "message": f"Loan disbursement has been queued for processing." + }), 200 @autocall_bp.route("/direct/repayment", methods=["POST"]) def direct_repayment(): -- 2.34.1