From 92539449c4f2868b395b74d62321db4c98e890f4 Mon Sep 17 00:00:00 2001 From: SuhorukovAnton Date: Thu, 9 Mar 2023 15:34:47 +0300 Subject: [PATCH] backup chunk-size --- .../ASC.Data.Backup.Core/Service/BackupSettings.cs | 1 + common/ASC.Data.Backup.Core/Service/BackupWorker.cs | 12 ++++++++---- config/backup.json | 3 ++- web/ASC.Web.Core/SetupInfo.cs | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/common/ASC.Data.Backup.Core/Service/BackupSettings.cs b/common/ASC.Data.Backup.Core/Service/BackupSettings.cs index 120e8a61b6..f03e080ca4 100644 --- a/common/ASC.Data.Backup.Core/Service/BackupSettings.cs +++ b/common/ASC.Data.Backup.Core/Service/BackupSettings.cs @@ -30,6 +30,7 @@ public class BackupSettings { public string UpgradesPath { get; set; } public int Limit { get; set; } + public long ChunkSize { get; set; } public ServiceConfigurationElement Service { get; set; } public SchedulerConfigurationElement Scheduler { get; set; } public CleanerConfigurationElement Cleaner { get; set; } diff --git a/common/ASC.Data.Backup.Core/Service/BackupWorker.cs b/common/ASC.Data.Backup.Core/Service/BackupWorker.cs index a149031bbd..269fb08e8e 100644 --- a/common/ASC.Data.Backup.Core/Service/BackupWorker.cs +++ b/common/ASC.Data.Backup.Core/Service/BackupWorker.cs @@ -36,19 +36,22 @@ public class BackupWorker private DistributedTaskQueue _progressQueue; private int _limit; private string _upgradesPath; - private readonly TempPath _tempPath; + private readonly TempPath _tempPath; + private readonly SetupInfo _setupInfo; private readonly IServiceProvider _serviceProvider; private readonly object _synchRoot = new object(); public BackupWorker( IDistributedTaskQueueFactory queueFactory, IServiceProvider serviceProvider, - TempPath tempPath) + TempPath tempPath, + SetupInfo setupInfo) { _serviceProvider = serviceProvider; _progressQueue = queueFactory.CreateQueue(CUSTOM_DISTRIBUTED_TASK_QUEUE_NAME); _tempPath = tempPath; - TempFolder = Path.Combine(_tempPath.GetTempPath(), "backup"); + TempFolder = Path.Combine(_tempPath.GetTempPath(), "backup"); + _setupInfo = setupInfo; } public void Start(BackupSettings settings) @@ -59,7 +62,8 @@ public class BackupWorker } _limit = settings.Limit; - _upgradesPath = settings.UpgradesPath; + _upgradesPath = settings.UpgradesPath; + _setupInfo.ChunkUploadSize = settings.ChunkSize; } public void Stop() diff --git a/config/backup.json b/config/backup.json index 6e3acf6dc2..f5b5ad0ab7 100644 --- a/config/backup.json +++ b/config/backup.json @@ -15,6 +15,7 @@ "Cleaner": { "Period":"00:15:00" - } + }, + "ChunkSize": 20971520 } } \ No newline at end of file diff --git a/web/ASC.Web.Core/SetupInfo.cs b/web/ASC.Web.Core/SetupInfo.cs index 8f33077399..5c48637f06 100644 --- a/web/ASC.Web.Core/SetupInfo.cs +++ b/web/ASC.Web.Core/SetupInfo.cs @@ -61,7 +61,7 @@ public class SetupInfo } public string TeamlabSiteRedirect { get; private set; } - public long ChunkUploadSize { get; private set; } + public long ChunkUploadSize { get; set; } public long ProviderMaxUploadSize { get; private set; } public bool ThirdPartyAuthEnabled { get; private set; } public string NoTenantRedirectURL { get; private set; }