Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

Commit 16160ad

Browse files
committed
add keep alive
1 parent 6012919 commit 16160ad

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

gapic/utils/cache.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,14 @@ def wrapper(self, *, collisions, **kwargs):
9898
visited = kwargs.get('visited_messages')
9999
vis_key = tuple(sorted(id(m) for m in visited)) if visited else None
100100

101-
key = (self, col_key, skip_key, vis_key)
101+
key = (id(self), col_key, skip_key, vis_key)
102102

103103
# 3. Check Cache
104104
if key in context_cache:
105105
return context_cache[key]
106106

107+
keep_alive.append(self)
108+
107109
# 4. Execute the actual function
108110
# We ensure context_cache is passed down to the recursive calls
109111
result = func(self, collisions=collisions, **kwargs)

0 commit comments

Comments
 (0)