Skip to content

Add arg to define thread limit - to throttle concurrent API calls when required#355

Open
monrog2 wants to merge 4 commits intomasterfrom
thread-limit
Open

Add arg to define thread limit - to throttle concurrent API calls when required#355
monrog2 wants to merge 4 commits intomasterfrom
thread-limit

Conversation

@monrog2
Copy link
Collaborator

@monrog2 monrog2 commented Feb 25, 2026

    parser.add_argument("--max-threads", action="store", type=int, default=None, help="Maximum number of check threads to run concurrently. Defaults to unlimited.")

Comment on lines +1517 to +1521
try:
print(objects, sep=sep, end=end, file=sys.stdout)
sys.stdout.flush()
except OSError:
pass
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pytests were intermittently failing with Bad File Descriptor

Comment on lines +53 to +63
# Join each task thread to ensure any in-progress prints complete before
# capsys.readouterr() is called. Without this there is a race where a
# thread passes the `if not global_timeout` check and then tries to print
# after pytest has already torn down the captured stdout fd, causing
# OSError: [Errno 9] Bad file descriptor.
for thread in tm.threads:
try:
thread.join(timeout=1.5)
except RuntimeError:
pass # thread was never started

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handling another scenario where Bad File descriptor would intermittently fail this specific pytest

@monrog2 monrog2 changed the title Thread limit Add arg to define thread limit - to throttle concurrent API calls when required Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant