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

[TSK-151] Refactor Session Handling #134

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

ydamit
Copy link
Collaborator

@ydamit ydamit commented Oct 25, 2024

Passing a context manager to dependency injection to enforce the opening and closing of a single DB session with each method call.

@ydamit ydamit self-assigned this Oct 25, 2024
Copy link

@ydamit
Copy link
Collaborator Author

ydamit commented Nov 1, 2024

@maany I got as far as I could with this, but I'm afraid I wasn't able to solve the remaining issues. The test that's failing now is test_extend_research_context_controller in test_extend_research_context_feature.py.

Short version: I suspect we're still running into the same yield vs. return problem. The test fails on the second attempt to use the db.

More context: I tried using the debugger a lot this week. I confirmed that the test is able to use the usecase's get_client_by_sub() method successfully. But then it moves to trying list_source_data(), which returns a Server Error in the view model, saying that _GeneratorContextManager doesn't have args. I zeroed into what was happening, and it looks like the call to list_source_data() doesn't get fully processed by the wrapper() in utils.py before the process steps directly to the errored view model. However, attempting to watch the variables didn't show any difference between the wrapper getting used on get_client_by_sub() vs. on list_source_data().

Unfortunately, my macbook has also been getting slower and slower all week, to the point where it's hard to use now. SO I need to take the weekend anyway to save things, run updates, restart, etc. anyway.

Hopefully this is enough to make it easy for you to solve!

@maany
Copy link
Collaborator

maany commented Nov 3, 2024

@ydamit the errors you are seeing might not be related to your work.
#142
We noticed the unexpected behavior even without the decorator yesterday and have put an temporary fix just to make it to the release deadline

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants