Skip to content

Commit

Permalink
fix: use async lru_cache
Browse files Browse the repository at this point in the history
  • Loading branch information
keejon committed Feb 3, 2025
1 parent 6e61dfe commit 7125695
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ dependencies = [
"accept-types < 1",
"aiohttp < 4",
"aiokafka == 0.10.0",
"async_lru",
"cachetools == 5.3.3",
"confluent-kafka == 2.4.0",
"isodate < 1",
Expand Down
4 changes: 2 additions & 2 deletions src/karapace/serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
from __future__ import annotations

from aiohttp import BasicAuth
from async_lru import alru_cache
from avro.io import BinaryDecoder, BinaryEncoder, DatumReader, DatumWriter
from cachetools import TTLCache
from collections.abc import MutableMapping
from functools import lru_cache
from google.protobuf.message import DecodeError
from jsonschema import ValidationError
from karapace.client import Client
Expand Down Expand Up @@ -180,7 +180,7 @@ async def _get_schema_recursive(
except InvalidSchema as e:
raise SchemaRetrievalError(f"Failed to parse schema string from response: {json_result}") from e

@lru_cache(maxsize=100)
@alru_cache(maxsize=100)
async def get_schema(
self,
subject: Subject,
Expand Down

0 comments on commit 7125695

Please sign in to comment.