Skip to content

Commit

Permalink
fix: caching bug (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xMochan authored Jun 10, 2024
1 parent ffac7f4 commit 196b3a2
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions subgrounds/client/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
from importlib import resources
from pathlib import Path
from typing import Annotated, Any, Type, cast
from typing_extensions import Self

from pipe import groupby, map, traverse
from typing_extensions import Self

from ..errors import SubgroundsError
from ..pagination import (
Expand Down Expand Up @@ -149,10 +149,8 @@ def cache_schema(self, url: str, data: dict[str, Any]):
self.schema_cache.mkdir(parents=True, exist_ok=True)
schema_path = self.schema_cache / self._subgraph_slug(url)

if (schema := schema_path.with_suffix(".json")).exists():
schema.write_text(json.dumps(data))
else:
raise ValueError(f"Schema at {schema} doesn't exist.")
schema = schema_path.with_suffix(".json")
schema.write_text(json.dumps(data))

def _load(
self, url: str, save_schema: bool = False, is_subgraph: bool = True
Expand Down

0 comments on commit 196b3a2

Please sign in to comment.