Skip to content

Commit

Permalink
Info now does its head request to a cache instead of the collections-url
Browse files Browse the repository at this point in the history
-- Adjusted the test to account for the extra head request when doing an initial cache check
  • Loading branch information
turetske committed Aug 18, 2024
1 parent 95a97e0 commit 0b807e8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/pelicanfs/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,12 +467,6 @@ async def _glob(self, path, maxdepth=None, **kwargs):
else:
return list(out)


@_dirlist_dec
async def _info(self, path, **kwargs):
results = await self.httpFileSystem._info(path, **kwargs)
return self._remove_host_from_paths(results)

@_dirlist_dec
async def _du(self, path, total=True, maxdepth=None, **kwargs):
return await self.httpFileSystem._du(path, total, maxdepth, **kwargs)
Expand Down Expand Up @@ -628,6 +622,10 @@ async def _exists(self, path, **kwargs):
async def _get_file(self, rpath, lpath, **kwargs):
return await self.httpFileSystem._get_file(rpath, lpath, **kwargs)

@_cache_dec
async def _info(self, path, **kwargs):
results = await self.httpFileSystem._info(path, **kwargs)
return self._remove_host_from_paths(results)

@_cache_multi_dec
async def _cat(self, path, recursive=False, on_error="raise", batch_size=None, **kwargs):
Expand Down
1 change: 1 addition & 0 deletions test/test_director.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ def test_info(httpserver: HTTPServer, get_client):
"X-Pelican-Namespace": "namespace=/foo"
},
)
httpserver.expect_oneshot_request("/foo/bar", method="HEAD").respond_with_data(listing_response)
httpserver.expect_request("/foo/bar", method="GET").respond_with_data(listing_response)
pelfs = pelicanfs.core.PelicanFileSystem(
httpserver.url_for("/"),
Expand Down

0 comments on commit 0b807e8

Please sign in to comment.