Skip to content

Commit

Permalink
feat: 超大订阅方案 (closed #2429)
Browse files Browse the repository at this point in the history
  • Loading branch information
wyyalt committed Nov 11, 2024
1 parent bf9b5e8 commit deaf835
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion apps/backend/subscription/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ def get_host_detail(host_info_list: list, bk_biz_id: int = None, data_backend: s
bk_cloud_ids.append(host["bk_cloud_id"])

host_relations: Union[RedisList, list] = find_host_biz_relations(
list(set(bk_host_ids), data_backend), source="get_host_detail", data_backend=data_backend
list(set(bk_host_ids)), source="get_host_detail", data_backend=data_backend
)
host_biz_map = {}
for host in host_relations:
Expand Down Expand Up @@ -833,6 +833,7 @@ def wrapper(
nodes = sorted(scope["nodes"], key=lambda node: node.get("bk_biz_id") or scope.get("bk_biz_id"))
params_list = [
{
"data_backend": data_backend,
"scope": {
"bk_biz_id": bk_biz_id,
"object_type": scope["object_type"],
Expand Down
5 changes: 3 additions & 2 deletions apps/utils/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,9 @@ def __next__(self):

def extend(self, iterable: Iterable[Any]) -> None:
serialized_items = [json.dumps(item) for item in iterable]
self.client.rpush(self.uuid_key, *serialized_items)
self._update_redis_expiry()
if serialized_items:
self.client.rpush(self.uuid_key, *serialized_items)
self._update_redis_expiry()

def append(self, obj: Any) -> None:
self.client.rpush(self.uuid_key, json.dumps(obj))
Expand Down

0 comments on commit deaf835

Please sign in to comment.