Skip to content

Commit a8efdf5

Browse files
AmitMYclaude
andcommitted
fix: move need computation before its use in acquire()
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 251b7d8 commit a8efdf5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/python/pose_format/utils/holistic.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ def acquire(cls, n: int, config: dict) -> list:
121121
while pool and len(acquired) < n:
122122
acquired.append(pool.pop())
123123

124+
need = n - len(acquired)
125+
124126
# Clear tracking state for reused instances by processing a blank frame.
125127
# This flushes the PreviousLoopbackCalculator state so the next real frame
126128
# runs full detection instead of using stale tracking from a previous video.
@@ -129,7 +131,6 @@ def acquire(cls, n: int, config: dict) -> list:
129131
with ThreadPoolExecutor(max_workers=len(reused)) as ex:
130132
list(ex.map(lambda h: h.process(cls._BLANK_FRAME), reused))
131133

132-
need = n - len(acquired)
133134
if need > 0:
134135
with ThreadPoolExecutor(max_workers=need) as ex:
135136
new = list(ex.map(lambda _: mp_holistic.Holistic(**config), range(need)))

0 commit comments

Comments
 (0)