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

Flushed care_static_data prefixed redis keys #2572

Merged
merged 2 commits into from
Nov 2, 2024

Conversation

JohnLu2004
Copy link
Contributor

@JohnLu2004 JohnLu2004 commented Oct 28, 2024

  • Used delete_pattern from django-redis repo to delete keys

Proposed Changes

  • Deletes redis keys with care_static_data prefix

Associated Issue

Merge Checklist

  • Linting Complete
  • Any other necessary step

Only PR's with test cases included and passing lint and test pipelines will be reviewed

@ohcnetwork/care-backend-maintainers @ohcnetwork/care-backend-admins

care/facility/tasks/redis_index.py Outdated Show resolved Hide resolved
care/facility/tasks/redis_index.py Outdated Show resolved Hide resolved
Copy link
Member

@sainak sainak left a comment

Choose a reason for hiding this comment

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

reference delete_pattern from cache backend

https://github.com/jazzband/django-redis/blob/master/README.rst#scan--delete-keys-in-bulk

use itersize=25_000, to speed up the operation

care/facility/management/commands/load_redis_index.py Outdated Show resolved Hide resolved
care/facility/tasks/redis_index.py Outdated Show resolved Hide resolved
care/facility/tasks/redis_index.py Outdated Show resolved Hide resolved
* Used delete_pattern from django-redis repo to delete keys
@JohnLu2004
Copy link
Contributor Author

All the requested changes should be in place now 👍

Copy link

codecov bot commented Nov 1, 2024

Codecov Report

Attention: Patch coverage is 0% with 14 lines in your changes missing coverage. Please review.

Project coverage is 69.19%. Comparing base (67c63d9) to head (0858f68).
Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
care/facility/tasks/redis_index.py 0.00% 8 Missing ⚠️
...e/facility/management/commands/load_redis_index.py 0.00% 6 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2572      +/-   ##
===========================================
- Coverage    69.26%   69.19%   -0.07%     
===========================================
  Files          211      211              
  Lines        11928    11940      +12     
  Branches      1208     1208              
===========================================
  Hits          8262     8262              
- Misses        3290     3302      +12     
  Partials       376      376              

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

@vigneshhari
Copy link
Member

If the data load fails, we will end up with no data in the system, this is a flaw. An ideal implementation would only delete stale items maintaining the existing data somehow.
We will ignore this flaw for now because we are redesigning the coding system entirely.

@vigneshhari vigneshhari merged commit 6143667 into ohcnetwork:develop Nov 2, 2024
2 of 4 checks passed
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.

Flush Redis before loading static data
3 participants