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

[#2537] Implement a multi-zgw backend proxy to the individual clients #1281

Merged
merged 2 commits into from
Jul 1, 2024

Conversation

swrichards
Copy link
Collaborator

No description provided.

@codecov-commenter
Copy link

codecov-commenter commented Jun 26, 2024

Codecov Report

Attention: Patch coverage is 38.88889% with 110 lines in your changes missing coverage. Please review.

Project coverage is 44.22%. Comparing base (371f60e) to head (84c6b2c).

Files Patch % Lines
src/open_inwoner/openzaak/tests/test_clients.py 22.53% 55 Missing ⚠️
src/open_inwoner/openzaak/clients.py 49.01% 52 Missing ⚠️
src/open_inwoner/openzaak/exceptions.py 57.14% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1281      +/-   ##
===========================================
- Coverage    44.26%   44.22%   -0.04%     
===========================================
  Files          972      972              
  Lines        35414    35571     +157     
===========================================
+ Hits         15677    15733      +56     
- Misses       19737    19838     +101     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@swrichards swrichards force-pushed the tasks/2537-multiple-zgw-backend-client-factories branch 2 times, most recently from 0a8095e to ca2b643 Compare June 26, 2024 19:45
@swrichards swrichards marked this pull request as ready for review June 26, 2024 19:45
@swrichards swrichards requested a review from pi-sigma June 26, 2024 20:14
return resp.json()

def setUp(self):
self.a_url = "http://foo/bar/rows"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.a_url = "http://foo/bar/rows"
self.url_1 = "http://foo/bar/rows"

@swrichards swrichards force-pushed the tasks/2537-multiple-zgw-backend-client-factories branch 2 times, most recently from 885beb2 to 2d3ad96 Compare June 27, 2024 13:21
@swrichards swrichards force-pushed the tasks/2537-multiple-zgw-backend-client-factories branch 2 times, most recently from fbda08a to 6378e7f Compare June 27, 2024 13:26
@swrichards swrichards requested a review from pi-sigma June 27, 2024 13:26
@swrichards swrichards requested a review from alextreme June 27, 2024 13:54
def failing_responses(self) -> list[ZgwClientResponse]:
return list(r for r in self if r.exception is not None)

@cached_property
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this is workable in the context of uwsgi, where we have threading active within the same process. In-memory caching without taking this into account is a bit of a minefield, please err on the side of caution considering our domain

Copy link
Collaborator Author

@swrichards swrichards Jun 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I naively thought cached_property was thread-safe, which it is, but apparently the problem here is not so much with cache consistency as it is with some pretty severe thread contention issues, which was fixed in Python 3.12 (see the note in the docs at the end of the cached_property section). In any case, this was all just generally interesting FYI, but I take your point: even a small risk of cache consistency troubles here is not worth it, and premature, marginal optimization was not called for here in any case. I've changed them to plain @property fields.

@swrichards swrichards force-pushed the tasks/2537-multiple-zgw-backend-client-factories branch from 6378e7f to 84c6b2c Compare June 28, 2024 13:38
@swrichards swrichards requested a review from alextreme June 28, 2024 14:59
@alextreme alextreme merged commit fbd9100 into develop Jul 1, 2024
17 checks passed
@alextreme alextreme deleted the tasks/2537-multiple-zgw-backend-client-factories branch July 1, 2024 08:19
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.

4 participants