Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: improve task management in _log_transaction_async to avoid datab…
…ase locks (#5896) * refactor: Update _log_transaction_async to be asynchronous and improve task management - Changed _log_transaction_async method from synchronous to asynchronous to allow proper handling of transaction logging. - Added error handling for task cancellation and ensured that pending tasks are managed correctly. - Updated calls to _log_transaction_async in the ComponentVertex class to await the asynchronous method, ensuring proper flow execution and error handling. * refactor: Simplify _log_transaction_async method by removing redundant error handling - Streamlined the _log_transaction_async method to enhance readability and maintainability. - Removed unnecessary try-except blocks for task cancellation, as the async context already handles task management effectively. - Ensured that completed tasks are awaited and cleared properly, improving overall task management. * fix: Correctly handle vertex build response in asynchronous flow construction - Moved the retrieval of the vertex build response to occur after awaiting the build task, ensuring proper handling of task completion. - Improved error handling by maintaining the cancellation logic while ensuring the response is only accessed after the task is completed. - This change enhances the reliability of the flow construction process in the chat API. * fix: Improve task management in Vertex class by refining log transaction handling - Updated the log transaction handling in the Vertex class to await a single task instead of gathering all tasks, enhancing efficiency. - Removed the clearing of the task list, ensuring that only the most recent task is processed, which simplifies the task management logic. - This change aims to improve the reliability and performance of asynchronous logging in the flow execution. * refactor: Comment out log transaction handling in Vertex class for future review
- Loading branch information