Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Improve data consistency in update_flow function #5516

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

Cristhianzl
Copy link
Member

This pull request includes several changes to the update_flow function and a utility function in the backend of the Langflow API. The modifications aim to improve error handling, ensure data integrity, and enhance functionality.

Improvements to update_flow function:

  • Added a check to set flow.data to db_flow.data if it is None to ensure data consistency.
  • Added a return statement to return db_flow after committing the session, ensuring the updated flow is returned.
  • Moved the session rollback inside the except block to handle errors more gracefully and ensure the database state is not corrupted.

Enhancements to utility function:

  • Added a check for the presence of "nodes" in flow_data to prevent potential attribute errors in the get_webhook_component_in_flow function.

…d in the database during flow update

📝 (flows.py): Improve error handling and rollback database session in case of exceptions during flow update
📝 (flows.py): Refactor code to handle unique constraint errors and provide more informative error messages
📝 (utils.py): Refactor get_webhook_component_in_flow function to handle cases where flow_data may not have 'nodes' attribute
@Cristhianzl Cristhianzl self-assigned this Jan 2, 2025
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. bug Something isn't working labels Jan 2, 2025
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Jan 2, 2025
@Cristhianzl Cristhianzl marked this pull request as draft January 2, 2025 16:26
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Jan 2, 2025
Copy link

codspeed-hq bot commented Jan 2, 2025

CodSpeed Performance Report

Merging #5516 will improve performances by 26.12%

Comparing cz/fix-move-flow-folder (57d562b) with main (70eaacf)

Summary

⚡ 2 improvements
✅ 13 untouched benchmarks

Benchmarks breakdown

Benchmark main cz/fix-move-flow-folder Change
test_get_and_cache_all_types_dict 1.3 ms 1 ms +26.12%
test_successful_run_with_output_type_debug 352.5 ms 299.7 ms +17.63%

…r folder buttons for improved accessibility and testing

✨ (general-bugs-move-flow-from-folder.spec.ts): add test to ensure user can move flow from one folder to another in the frontend application
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Jan 2, 2025
@Cristhianzl Cristhianzl marked this pull request as ready for review January 2, 2025 18:16
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Jan 2, 2025
…l data inconsistency

♻️ (service.py): refactor with_session method to handle session commit and rollback more effectively
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Jan 3, 2025
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Jan 6, 2025
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Jan 7, 2025
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Jan 7, 2025
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Jan 7, 2025
@italojohnny italojohnny force-pushed the cz/fix-move-flow-folder branch from c936ebb to b0cd684 Compare January 7, 2025 17:40
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Jan 7, 2025
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Jan 7, 2025
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Jan 7, 2025
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Jan 7, 2025
@italojohnny italojohnny added lgtm This PR has been approved by a maintainer and removed lgtm This PR has been approved by a maintainer labels Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants