Problem
examples/api_request_parallel_processor.py accepts non-positive values for max_requests_per_minute, max_tokens_per_minute, and max_attempts.
These values can make the processor fail to terminate:
max_requests_per_minute <= 0: request capacity never reaches 1, so a pending request is never scheduled.
max_tokens_per_minute <= 0: token capacity never reaches a positive request cost, so a pending request can wait forever.
max_attempts == 0: the processor decrements attempts_left before the request call, making it -1; on failure, if self.attempts_left: remains truthy for negative values, so the request is requeued indefinitely.
Expected behavior
Reject invalid non-positive limits at the processor boundary before opening the request file or entering the scheduling loop.
Suggested fix
Validate:
max_requests_per_minute > 0
max_tokens_per_minute > 0
max_attempts >= 1
with clear ValueError messages, leaving all valid inputs unchanged.
Problem
examples/api_request_parallel_processor.pyaccepts non-positive values formax_requests_per_minute,max_tokens_per_minute, andmax_attempts.These values can make the processor fail to terminate:
max_requests_per_minute <= 0: request capacity never reaches 1, so a pending request is never scheduled.max_tokens_per_minute <= 0: token capacity never reaches a positive request cost, so a pending request can wait forever.max_attempts == 0: the processor decrementsattempts_leftbefore the request call, making it-1; on failure,if self.attempts_left:remains truthy for negative values, so the request is requeued indefinitely.Expected behavior
Reject invalid non-positive limits at the processor boundary before opening the request file or entering the scheduling loop.
Suggested fix
Validate:
max_requests_per_minute > 0max_tokens_per_minute > 0max_attempts >= 1with clear
ValueErrormessages, leaving all valid inputs unchanged.