From fc0ba190f750ef03514b3da65b72d9883627539a Mon Sep 17 00:00:00 2001 From: Benjamin Nguyen Date: Tue, 29 Oct 2024 09:17:21 -0600 Subject: [PATCH] python(bug): fix download bug for same channel requested --- python/lib/sift_py/data/service.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/python/lib/sift_py/data/service.py b/python/lib/sift_py/data/service.py index cf939953..3172a412 100644 --- a/python/lib/sift_py/data/service.py +++ b/python/lib/sift_py/data/service.py @@ -330,16 +330,19 @@ async def _load_channels( if chans.get(fqn) is None: channels_to_retrieve.append(fqn) - sift_channels = await self._get_channels_by_asset_id_and_channel_fqns( - asset.asset_id, channels_to_retrieve - ) + sift_channels = [] + if len(channels_to_retrieve) > 0: + sift_channels = await self._get_channels_by_asset_id_and_channel_fqns( + asset.asset_id, channels_to_retrieve + ) channels = defaultdict(list) for c in sift_channels: channels[channel_fqn(c.name, c.component)].append(c) - self._cached_channels[asset.name].update(channels) + if len(channels) > 0: + self._cached_channels[asset.name].update(channels) return self._cached_channels[asset.name] @@ -422,7 +425,7 @@ async def _get_runs_by_names(self, run_names: Set[str]) -> List[Run]: async def _get_channels_by_asset_id_and_channel_fqns( self, asset_id: str, channel_fqns: List[str] ) -> List[Channel]: - if len(asset_id) == 0: + if len(asset_id) == 0 or len(channel_fqns) == 0: return [] channels: List[Channel] = []