mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-23 10:07:48 -06:00
refactor: route network access through upstream
Branch heads (scrapers, FBNeo import, data directories) resolve through core.upstream.resolve_head, with cache_dir=None to keep nothing under .cache/upstream. Streaming downloads (large files, external pack files, data directory archives, scraper downloads, standalone probe) go through one core.upstream.download: scratch then rename, size cap, retries of a cut stream, a 5xx or a rate limit. The shared rate limit wait reads GoatCounter's X-Rate-Limit-Reset, so site insights, download.py, indexnow and the contributor list use the same retrying client. list_gitlinks raises TruncatedListingError on a partial tree, read from one tree walk shared with list_tree (Forgejo paging included). The Recalbox configs/ listing is paged with the shared page cap.
This commit is contained in:
1 parent
526d7f09c7
commit
8a8fa71fbc
25 files changed
+708
-266
No files matched your search
@@ -38,6 +38,8 @@ def _zip_bytes(files: dict[str, bytes]) -> bytes:
|
||||
|
||||
|
||||
class _Response(io.BytesIO):
|
||||
headers: dict[str, str] = {}
|
||||
|
||||
def __enter__(self):
|
||||
return self
|
||||
|
||||
@@ -466,6 +468,17 @@ class TheRemoteCommitComesFromTheForgeClient(unittest.TestCase):
|
||||
self.assertEqual((sha, len(seen)), ("b" * 40, 2))
|
||||
self.assertEqual(seen[0].get_header("Authorization"), "Bearer SECRET")
|
||||
|
||||
def test_the_answer_is_not_cached(self):
|
||||
from core import upstream
|
||||
|
||||
with mock.patch.object(upstream, "write_cache") as write:
|
||||
sha, _seen = self._resolve(
|
||||
"https://github.com/o/n/archive/{version}.tar.gz", "master",
|
||||
[[{"sha": "c" * 40}]],
|
||||
)
|
||||
self.assertEqual(sha, "c" * 40)
|
||||
write.assert_not_called()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user