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

Adding multiprocessing tests for LRUCache #21893

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ayaka14732
Copy link
Member

This PR is a follow-up of #21394, adding multiprocessing tests for LRUCache. This guarantees that the LRUCache implementation is process-safe.

@ayaka14732 ayaka14732 self-assigned this Jun 14, 2024
Copy link
Member

@superbobry superbobry left a comment

Choose a reason for hiding this comment

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

The tests seem to be failing?

bytes_a = b"a" * (large_number + 1)
bytes_b = b"a" * (large_number + 1)

cache = LRUCache(self.name, max_size=large_number * 2)
Copy link
Member

Choose a reason for hiding this comment

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

Maybe make this local to call_multiple_puts_and_gets, so that each process has its own instance?

And then create one local to the test process on L180.

if file.is_file():
file_size = file.stat().st_size
file_mtime = file.stat().st_mtime_ns
if file.is_file() and file != self.lock_path:
Copy link
Member

Choose a reason for hiding this comment

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

Good catch!

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.

None yet

2 participants