Spaces:
Paused
Paused
fix: bust fsspec listing cache for v2 upload discovery
Browse files
src/small_cuts/hf_relay.py
CHANGED
|
@@ -216,6 +216,13 @@ class BucketSceneClient:
|
|
| 216 |
glob = getattr(self.fs, "glob", None)
|
| 217 |
if glob is None:
|
| 218 |
return []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 219 |
try:
|
| 220 |
scene_paths = glob(f"{self.root}/uploads/*/scene.json")
|
| 221 |
except FileNotFoundError:
|
|
|
|
| 216 |
glob = getattr(self.fs, "glob", None)
|
| 217 |
if glob is None:
|
| 218 |
return []
|
| 219 |
+
# fsspec caches directory listings for the life of the fs object, so a newly published
|
| 220 |
+
# uploads/<id>/scene.json would never be globbed (the v2 manifest-less path) until the fs is
|
| 221 |
+
# recreated. Bust the listing cache before globbing. The manifest (cat) path is unaffected,
|
| 222 |
+
# so the live Space's manifest-based relay is unchanged.
|
| 223 |
+
invalidate_listings = getattr(self.fs, "invalidate_cache", None)
|
| 224 |
+
if invalidate_listings is not None:
|
| 225 |
+
invalidate_listings()
|
| 226 |
try:
|
| 227 |
scene_paths = glob(f"{self.root}/uploads/*/scene.json")
|
| 228 |
except FileNotFoundError:
|