Commit d330c770 authored by Yannick's avatar Yannick
Browse files

add some logging

parent 677d74d8
Pipeline #44967 passed with stage
in 50 seconds
......@@ -30,7 +30,8 @@ class PartitionService:
@staticmethod
async def get_partition(data_partition_id: str) -> PartitionInfo:
partition_info = PartitionsCache.get(data_partition_id)
if not partition_info:
if partition_info is None:
_LOGGER.info(f'Partition info "{data_partition_id}" not cached => fetch it')
partition_info = await PartitionService._partition_client().get_partition(data_partition_id)
if partition_info:
_LOGGER.info(f'PartitionService fetching partition info for "{data_partition_id}"')
......
import logging
from cachetools import TTLCache
_LOGGER = logging.getLogger(__name__)
class PartitionsCache:
partitions_cache = TTLCache(maxsize=100, ttl=300)
......@@ -10,6 +13,7 @@ class PartitionsCache:
@staticmethod
def set(data_partition_id: str, partition_info):
_LOGGER.info(f"set in partition cache {PartitionsCache} info from '{data_partition_id}'")
PartitionsCache.partitions_cache[data_partition_id] = partition_info
@staticmethod
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment