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

Handle cache_timeout = 0 in GCSFileSystem #646

Merged
merged 2 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gcsfs/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ def __init__(
version_aware=False,
**kwargs,
):
if cache_timeout:
if cache_timeout is not None:
kwargs["listings_expiry_time"] = cache_timeout
super().__init__(
self,
Expand Down
2 changes: 2 additions & 0 deletions gcsfs/tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1428,6 +1428,8 @@ def test_expiry_keyword():
assert gcs.dircache.listings_expiry_time == 1
gcs = GCSFileSystem(cache_timeout=1, token="anon")
assert gcs.dircache.listings_expiry_time == 1
gcs = GCSFileSystem(cache_timeout=0, token="anon")
assert gcs.dircache.listings_expiry_time == 0
Copy link
Member

Choose a reason for hiding this comment

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

Does this imply that the cache is disabled? What was the previous value before this PR, None?

Copy link
Contributor Author

@amyewang amyewang Oct 31, 2024

Choose a reason for hiding this comment

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

Yes, based on the docstring the listings_expiry_time should be set to 0, which means cache has a timeout of 0. Before this change the gcs.dircache.listings_expiry_time evaluated to None, so the cache was enabled



def test_copy_cache_invalidated(gcs):
Expand Down
Loading