Skip to content

Create the API tests' backtests one at a time - #10237

Merged
Martin-Molinero merged 2 commits into
masterfrom
bug-api-tests-throttle-backtest-creates
Nov 25, 2026
Merged

Martin-Molinero merged 2 commits into
masterfrom
bug-api-tests-throttle-backtest-creates

Conversation

@Martin-Molinero

@Martin-Molinero Martin-Molinero commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

The master API Tests fail intermittently, for example run 45620934701. Api.CreateBacktest throws a NullReferenceException at Api.cs:366.

Cause: since #10149, ProjectTests runs in parallel and starts about 20 backtest creates at once. The API handles a user's creates one at a time. A create that waits too long for its turn is refused with "Too many concurrent requests; please slow down" and returns no backtest. A waiting create only retries for 30 to 60 seconds.

Fix: the tests go through a new ApiTestBase.CreateBacktest that creates one backtest at a time. Only the create call is serialized, not compiling or waiting for the backtest to finish. Since the API already handles a user's creates one at a time, this shouldn't slow the run down.

🤖 Generated with Claude Code

The parallel project tests start about 20 backtest creates at once. The api
handles a user's creates one at a time and refuses one that waits too long
("Too many concurrent requests"), which fails the tests with a null reference.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Martin-Molinero Martin-Molinero changed the title Let the API tests create at most 6 backtests at a time Create the API tests' backtests one at a time Nov 25, 2026
The api handles a user's creates one at a time anyway, and a waiting create
only polls the lock once a second for 30 to 60 seconds, so even 6 in flight
can run out of time when the creates are slow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Martin-Molinero
Martin-Molinero force-pushed the bug-api-tests-throttle-backtest-creates branch from 5b76c6b to 7810eb9 Compare November 25, 2026 17:33
@Martin-Molinero
Martin-Molinero merged commit 65e0985 into master Nov 25, 2026
22 of 23 checks passed
@Martin-Molinero
Martin-Molinero deleted the bug-api-tests-throttle-backtest-creates branch November 25, 2026 19:52
sparx82 added a commit to sparx82/Lean that referenced this pull request Nov 26, 2026
Create the API tests' backtests one at a time (QuantConnect#10237)
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