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

🐛 fixes cache issue in web-server services i/o model #6176

Merged
merged 9 commits into from
Aug 13, 2024

Conversation

pcrespov
Copy link
Member

@pcrespov pcrespov commented Aug 12, 2024

What do these changes do?

During manual testing on the master deployment, specifically with PR #6169, we identified that the caching mechanism for the services listing is failing due to issues with async concurrency. This problem causes the entire service call to fail.

Changes in This PR

  • Replaces Sync Caching with Async Caching:
    • The existing synchronous caching implementation using cachetools has been replaced with an asynchronous caching solution using aiocache to better handle concurrent calls.
    • This change eliminates the need for asyncio.thread, simplifying the implementation.
    • The cachetools dependency has been removed from the project.
  • Improves Error Handling:
    • Previously, a failure in the cache would lead to a 500 error because the cache error resulted in an invalid model (e.g., some fields in the input were correct while others were not, due to the failure).
    • The updated implementation ensures that the model is not modified until all I/O fields have been properly validated, thus preventing the propagation of incomplete or invalid data and improving the stability of the service.

Related issue/s

How to test

This issue can only be replicated using the config in master

Dev-ops checklist

@pcrespov pcrespov self-assigned this Aug 12, 2024
@pcrespov pcrespov changed the title 🐛 Is5964/async cache 🐛 web-server services i/o model: replaces sync by async caching Aug 12, 2024
@pcrespov pcrespov added the a:webserver issue related to the webserver service label Aug 12, 2024
@pcrespov pcrespov added this to the Eisbock milestone Aug 12, 2024
@pcrespov pcrespov changed the title 🐛 web-server services i/o model: replaces sync by async caching 🐛 web-server services i/o model: Aug 12, 2024
@pcrespov pcrespov marked this pull request as ready for review August 12, 2024 18:13
@pcrespov pcrespov requested a review from odeimaiz August 12, 2024 18:13
@pcrespov pcrespov changed the title 🐛 web-server services i/o model: 🐛 fixes cache web-server services i/o model Aug 12, 2024
@pcrespov pcrespov changed the title 🐛 fixes cache web-server services i/o model 🐛 fixes cache issue in web-server services i/o model Aug 12, 2024
Copy link

codecov bot commented Aug 12, 2024

Codecov Report

Attention: Patch coverage is 84.37500% with 5 lines in your changes missing coverage. Please review.

Project coverage is 74.7%. Comparing base (cafbf96) to head (a2c4331).
Report is 430 commits behind head on master.

Files Patch % Lines
...rver/src/simcore_service_webserver/catalog/_api.py 37.5% 5 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #6176      +/-   ##
=========================================
- Coverage    84.5%   74.7%    -9.9%     
=========================================
  Files          10     347     +337     
  Lines         214   17260   +17046     
  Branches       25       0      -25     
=========================================
+ Hits          181   12904   +12723     
- Misses         23    4356    +4333     
+ Partials       10       0      -10     
Flag Coverage Δ
unittests 74.7% <84.3%> (-9.9%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...rc/simcore_service_webserver/catalog/_api_units.py 92.8% <100.0%> (ø)
...r/src/simcore_service_webserver/catalog/_models.py 90.1% <100.0%> (ø)
...rver/src/simcore_service_webserver/catalog/_api.py 59.4% <37.5%> (ø)

... and 354 files with indirect coverage changes

Copy link
Member

@odeimaiz odeimaiz left a comment

Choose a reason for hiding this comment

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

👍

Copy link
Member

@sanderegg sanderegg left a comment

Choose a reason for hiding this comment

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

thanks!

Copy link
Contributor

@matusdrobuliak66 matusdrobuliak66 left a comment

Choose a reason for hiding this comment

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

thanks

@pcrespov pcrespov force-pushed the is5964/async-cache branch from 698d069 to 6028dda Compare August 13, 2024 09:43
@pcrespov pcrespov enabled auto-merge (squash) August 13, 2024 09:45
Copy link

@pcrespov pcrespov merged commit d4e6096 into ITISFoundation:master Aug 13, 2024
56 of 57 checks passed
@pcrespov pcrespov deleted the is5964/async-cache branch August 13, 2024 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:webserver issue related to the webserver service
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants