-
Notifications
You must be signed in to change notification settings - Fork 27
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
🐛Bugfix: Director v2 called from GC errors because of wrong use of yarl library #3207
🐛Bugfix: Director v2 called from GC errors because of wrong use of yarl library #3207
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3207 +/- ##
======================================
Coverage 82.0% 82.0%
======================================
Files 740 740
Lines 31574 31578 +4
Branches 4082 4084 +2
======================================
+ Hits 25897 25906 +9
+ Misses 4845 4839 -6
- Partials 832 833 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
|
services/web/server/src/simcore_service_webserver/director_v2_core_dynamic_services.py
Outdated
Show resolved
Hide resolved
@@ -38,12 +38,17 @@ async def get_dynamic_services( | |||
params["project_id"] = project_id | |||
|
|||
settings: DirectorV2Settings = get_plugin_settings(app) | |||
backend_url = (settings.base_url / "dynamic_services").update_query(**params) | |||
if params != {}: # Update query doesnt work with no params to unwrap |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if params != {}: # Update query doesnt work with no params to unwrap | |
if not params: # Update query doesnt work with no params to unwrap |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@GitHK suggestion is good idea BUT the condition he wrote is reversed i.e. it should be
backend_url: URL = settings.base_url / "dynamic_services"
if params:
backend_url = backend_url.update_query(**params)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please addressed the below minor suggestions.
…core_dynamic_services.py Co-authored-by: Andrei Neagu <5694077+GitHK@users.noreply.github.com>
@@ -38,12 +38,17 @@ async def get_dynamic_services( | |||
params["project_id"] = project_id | |||
|
|||
settings: DirectorV2Settings = get_plugin_settings(app) | |||
backend_url = (settings.base_url / "dynamic_services").update_query(**params) | |||
if params: # Update query doesnt work with no params to unwrap |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW i have been looking at the doc and this solution would also work (NOTE no **)
backend_url = (settings.base_url / "dynamic_services").update_query(params)
example
>>> from yarl import URL
>>> URL('http://example.com/path?a=b').update_query({'c': 'd'})
URL('http://example.com/path?a=b&c=d')
>>> URL('http://example.com/path?a=b').update_query({})
URL('http://example.com/path?a=b')
>>> URL('http://example.com/path?a=b').update_query(None)
URL('http://example.com/path?a=b')
Kudos, SonarCloud Quality Gate passed!
|
What do these changes do?
Fixes #3206
How to test
Check that the error and assoc. stack-trace mentioned in the issue #3206 is not happening anymore
Checklist