Skip to content

Commit

Permalink
Add config entry to override server chunk size
Browse files Browse the repository at this point in the history
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
  • Loading branch information
claucambra committed Jan 20, 2025
1 parent 2e284f6 commit d3e022a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/gui/folder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1154,7 +1154,7 @@ SyncOptions Folder::initializeSyncOptions() const
opt._parallelNetworkJobs = account->isHttp2Supported() ? 20 : 6;

// Chunk V2: Size of chunks must be between 5MB and 5GB, except for the last chunk which can be smaller
if (const auto capsMaxChunkSize = account->capabilities().maxChunkSize(); capsMaxChunkSize <= 0) {
if (const auto capsMaxChunkSize = account->capabilities().maxChunkSize(); capsMaxChunkSize <= 0 && !cfgFile.overrideServerChunkSize) {
opt.setMinChunkSize(capsMaxChunkSize);
opt.setMaxChunkSize(capsMaxChunkSize);
opt._initialChunkSize = capsMaxChunkSize);
Expand Down
7 changes: 7 additions & 0 deletions src/libsync/configfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ static constexpr char overrideLocalDirC[] = "overrideLocalDir";
static constexpr char isVfsEnabledC[] = "isVfsEnabled";
static constexpr char geometryC[] = "geometry";
static constexpr char timeoutC[] = "timeout";
static constexpr char overrideServerChunkSize[] = "overrideServerChunkSize";

Check warning on line 73 in src/libsync/configfile.cpp

View workflow job for this annotation

GitHub Actions / build

src/libsync/configfile.cpp:73:23 [readability-static-definition-in-anonymous-namespace]

'overrideServerChunkSize' is a static definition in anonymous namespace; static is redundant here
static constexpr char chunkSizeC[] = "chunkSize";

Check warning on line 74 in src/libsync/configfile.cpp

View workflow job for this annotation

GitHub Actions / build

src/libsync/configfile.cpp:74:23 [readability-static-definition-in-anonymous-namespace]

'chunkSizeC' is a static definition in anonymous namespace; static is redundant here
static constexpr char minChunkSizeC[] = "minChunkSize";
static constexpr char maxChunkSizeC[] = "maxChunkSize";
Expand Down Expand Up @@ -258,6 +259,12 @@ int ConfigFile::timeout() const
return settings.value(QLatin1String(timeoutC), 300).toInt(); // default to 5 min
}

bool ConfigFile::overrideServerChunkSize() const
{
QSettings settings(configFile(), QSettings::IniFormat);
return settings.value(QLatin1String(overrideServerChunkSize), false).toBool();
}

qint64 ConfigFile::chunkSize() const
{
QSettings settings(configFile(), QSettings::IniFormat);
Expand Down
1 change: 1 addition & 0 deletions src/libsync/configfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ class OWNCLOUDSYNC_EXPORT ConfigFile
void setShowInExplorerNavigationPane(bool show);

[[nodiscard]] int timeout() const;
[[nodiscard]] bool overrideServerChunkSize() const;
[[nodiscard]] qint64 chunkSize() const;
[[nodiscard]] qint64 maxChunkSize() const;
[[nodiscard]] qint64 minChunkSize() const;
Expand Down

0 comments on commit d3e022a

Please sign in to comment.