Repository navigation
Enable http2 support by default - #333
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR refactors how the parallel network job limit is configured to use a callable, enables HTTP/2 by default (with an opt-out via environment), and enriches logging with the local path context.
- Changed
SyncOptions::_parallelNetworkJobsfrom an integer to astd::function<int()>and updated all call sites and tests accordingly - Defaulted HTTP/2 support to
trueinAccount, and reversed the Env-var logic inAccessManagerto disable rather than enable HTTP/2 - Enhanced
SyncEnginelogging to include the local path of the sync run
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/testpermissions.cpp | Updated test setup to assign a lambda for _parallelNetworkJobs |
| src/libsync/syncoptions.h | Switched _parallelNetworkJobs to std::function<int()> |
| src/libsync/syncengine.cpp | Added _localPath to sync duration log |
| src/libsync/owncloudpropagator.cpp | Updated calls to use the callable for job limits (and logic bug) |
| src/libsync/discoveryphase.cpp | Updated to call the new _parallelNetworkJobs() function |
| src/libsync/account.h | Declared isHttp2Supported()/setHttp2Supported() and defaulted to true |
| src/libsync/account.cpp | Implemented the new HTTP/2 support accessors |
| src/libsync/accessmanager.cpp | Inverted Env-var config to disable HTTP/2 by default |
| src/gui/folder.cpp | Captured account pointer in lambda for parallel job config |
Comments suppressed due to low confidence (4)
src/libsync/accessmanager.cpp:84
- The new behavior around HTTP/2 default enablement and the DISABLED env var should have corresponding unit tests to verify both default-allowed and env-var-disabled paths.
static const bool http2DisabledEnv = qEnvironmentVariableIntValue("OPENCLOUD_HTTP2_DISABLED") == 1;
src/libsync/syncoptions.h:47
- [nitpick] The doc comment for
_parallelNetworkJobsshould be updated to explain that it is now a callable returning the job limit, not a fixed integer.
std::function<int()> _parallelNetworkJobs = [] { return 6; };
src/libsync/syncoptions.h:47
- Changing the type of a public sync option from
inttostd::function<int()>is an API/ABI breaking change; consider providing a compatibility shim or bumping the library version.
std::function<int()> _parallelNetworkJobs = [] { return 6; };
src/libsync/owncloudpropagator.cpp:79
- The original logic used qMin to cap the number of active transfers at 3; switching to std::max inverts this and now enforces a minimum of 3. Consider using std::min(3, ...) to preserve the intended upper limit.
return std::max(3, qCeil(_syncOptions._parallelNetworkJobs() / 2.));
845ff11 to
fa356c9
Compare
| return 1; | ||
| } | ||
| return qMin(3, qCeil(_syncOptions._parallelNetworkJobs / 2.)); | ||
| return std::max(3, qCeil(_syncOptions._parallelNetworkJobs() / 2.)); |
There was a problem hiding this comment.
@dragotin the min must have been an error because it would basically always set it to 3... besides the unit tests where _parallelNetworkJobs is set to 1 🙈
| QPointer<ResourcesCache> _resourcesCache; | ||
| QScopedPointer<AbstractCredentials> _credentials; | ||
| bool _http2Supported = false; | ||
| bool _http2Supported = true; |
There was a problem hiding this comment.
Is the goal not to initialize with false and then have https://github.com/opencloud-eu/desktop/pull/333/files#diff-12d910d5c97c3d9989a6731c12f2a81fb9a1153063bfe76f560afcc82b6420b4L67 set it to true?
supported = we tried it and it was actually used?
allowed = we attempt to try it at all
So basically only set 20 parallel if it worked once as http2
There was a problem hiding this comment.
Note: I don't know how often Folder::loadSyncOptions() gets called, because then the opt._parallelNetworkJobs would need to be re-evaluated after we know if works (if it gets called only once)
There was a problem hiding this comment.
that's why I replaced it with a std::function, the alternative would be to update it once _http2Supported changed.
The value here shouldn't really matter, as we will definitely have checked for http2 support once a sync starts.
|
|
||
| /** The maximum number of active jobs in parallel */ | ||
| int _parallelNetworkJobs = 6; | ||
| std::function<int()> _parallelNetworkJobs = [] { return 6; }; |
There was a problem hiding this comment.
hm, to make it more easy to understand, i'd add a comment here: // will be overwriten later in loadSyncOptions()
Fixes: #27