Skip to content

Commit

Permalink
✨ feat: can use serialized when subscribe config
Browse files Browse the repository at this point in the history
  • Loading branch information
mic1on committed Dec 12, 2023
1 parent 1e60fc3 commit b277927
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/use_nacos/endpoints/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ def subscribe(
group: str,
tenant: Optional[str] = '',
timeout: Optional[int] = 30_000,
serialized: Optional[bool] = False,
cache: Optional[BaseCache] = None,
callback: Optional[Callable] = None
) -> SyncAsync[Any]:
Expand All @@ -141,7 +142,7 @@ def _subscriber():
if not response:
continue
logging.info("Configuration update detected.")
last_config = self.get(data_id, group, tenant)
last_config = self.get(data_id, group, tenant, serialized=serialized)
last_md5 = _get_md5(last_config)
cache.set(config_key, last_config)
if callback:
Expand Down Expand Up @@ -214,8 +215,9 @@ async def subscribe(
group: str,
tenant: Optional[str] = '',
timeout: Optional[int] = 30_000,
serialized: Optional[bool] = False,
cache: Optional[BaseCache] = None,
callback: Optional[Callable] = None
callback: Optional[Callable] = None,
) -> SyncAsync[Any]:
cache = cache or MemoryCache()
config_key = _get_config_key(data_id, group, tenant)
Expand All @@ -233,7 +235,7 @@ async def _async_subscriber():
if not response:
continue
logging.info("Configuration update detected.")
last_config = await self.get(data_id, group, tenant)
last_config = await self.get(data_id, group, tenant, serialized=serialized)
last_md5 = _get_md5(last_config)
cache.set(config_key, last_config)
if callback:
Expand Down

0 comments on commit b277927

Please sign in to comment.