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

Fix key expiry when using sadd #93

Merged
merged 1 commit into from
May 31, 2022
Merged

Fix key expiry when using sadd #93

merged 1 commit into from
May 31, 2022

Conversation

amCap1712
Copy link
Member

We are passing prepared_name (namespace appended) to BU cache's expire method which again appends the namespace. Due to this, the following commands get executed:

SADD "CB-prod:Review:ws_cache_de0eedbf-e2d9-3a64-8e3e-51d68994cee3" "\xd9\x92list_entity_id=de0eedbf-e2d9-3a64-8e3e-51d68994cee3_user_id=None_sort=published_on_sort_order=None_limit=1_offset=0_language=None_review_type=None"
PEXPIRE "CB-prod:Review:CB-prod:Review:ws_cache_de0eedbf-e2d9-3a64-8e3e-51d68994cee3" "1800000"

As we can see, the pexpired key is wrong. Therefore, the sadd'ed keys live with infinite TTL in redis. Fix this by passing the un-prepared name to expire method.

We are passing prepared_name (namespace appended) to BU cache's expire
method which again appends the namespace. Due to this, the following
commands get executed:

SADD "CB-prod:Review:ws_cache_de0eedbf-e2d9-3a64-8e3e-51d68994cee3" "\xd9\x92list_entity_id=de0eedbf-e2d9-3a64-8e3e-51d68994cee3_user_id=None_sort=published_on_sort_order=None_limit=1_offset=0_language=None_review_type=None"
PEXPIRE "CB-prod:Review:CB-prod:Review:ws_cache_de0eedbf-e2d9-3a64-8e3e-51d68994cee3" "1800000"

As we can see, the pexpired key is wrong. Therefore, the sadd'ed keys
live with infinite TTL in redis. Fix this by passing the un-prepared
name to expire method.
@amCap1712 amCap1712 requested a review from alastair May 27, 2022 15:58
@github-actions

This comment has been minimized.

Copy link
Collaborator

@alastair alastair left a comment

Choose a reason for hiding this comment

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

🎉

@alastair alastair merged commit cc1e265 into master May 31, 2022
@alastair alastair deleted the fix-key-expiry branch May 31, 2022 10:19
@github-actions
Copy link

Unit Test Results

  1 files  ±0    1 suites  ±0   38s ⏱️ ±0s
81 tests ±0  81 ✔️ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit cc1e265. ± Comparison against base commit cc1e265.

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