Skip to content
This repository was archived by the owner on Oct 3, 2023. It is now read-only.

Commit 3162e42

Browse files
ludaavicsobendidi
authored andcommitted
Ignore async cache setting errors
1 parent ef9bae1 commit 3162e42

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

httpx_cache/cache/file.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,12 @@ async def aset(
9999
filepath = anyio.Path(
100100
get_cache_filepath(self.cache_dir, request, extra=self._extra)
101101
)
102-
to_cache = self.serializer.dumps(response=response, content=content)
103102
async with self.async_lock.writer:
104-
await filepath.write_bytes(to_cache)
103+
to_cache = self.serializer.dumps(response=response, content=content)
104+
try:
105+
await filepath.write_bytes(to_cache)
106+
except Exception:
107+
return None
105108

106109
def delete(self, request: httpx.Request) -> None:
107110
filepath = get_cache_filepath(self.cache_dir, request, extra=self._extra)

0 commit comments

Comments
 (0)