fix: network requests timing out too early #5729
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #5413
QNetworkAccessManager has a limited amount of network requests that can be in flight at the same time. This is reasonable.
We have not taken this into consideration with our custom timeout logic, instead starting the timeout timer as soon as we call
execute
on the network request, even if the request hasn't even reached the QNetworkAccessManager yet.With Qt 6.3.0, we gained access to the QNetworkReply::requestSent signal, which is emitted when the request starts flying. This makes our timeouts actually work as expected.
The added test can show a bit more detail how our logic was wrong before.
I expect to have to disable the test for Qt5 builds.