This addresses an issue that might occur when overriding poll_min_results from https://github.com/stealthrocket/dispatch-sdk-python/pull/92. If the value is less than the number of outstanding calls, Dispatch will unconditionally wait until the deadline (poll_max_wait_seconds). If no deadline is provided, Dispatch will never resume the coroutine and it will eventually expire.
This is not an issue with the default (poll_min_results=1) since there will always be at least one outstanding call when the scheduler yields to Dispatch (at least, until we introduce support for timers/sleep).
This PR fixes the issue by clamping min_results if it's greater than the number of outstanding calls.
This addresses an issue that might occur when overriding
poll_min_results
from https://github.com/stealthrocket/dispatch-sdk-python/pull/92. If the value is less than the number of outstanding calls, Dispatch will unconditionally wait until the deadline (poll_max_wait_seconds
). If no deadline is provided, Dispatch will never resume the coroutine and it will eventually expire.This is not an issue with the default (
poll_min_results=1
) since there will always be at least one outstanding call when the scheduler yields to Dispatch (at least, until we introduce support for timers/sleep).This PR fixes the issue by clamping
min_results
if it's greater than the number of outstanding calls.