From 6d250efffaac9df99c6bb485d8bc383ac1a9a562 Mon Sep 17 00:00:00 2001 From: Alexey Bannov Date: Tue, 21 Dec 2021 19:16:34 +0300 Subject: [PATCH 01/11] add *.dll for support redis + update Grpc.* dll --- common/ASC.Api.Core/Core/BaseStartup.cs | 2 + common/ASC.Common/ASC.Common.csproj | 6 ++- common/ASC.Common/Caching/RedisCache.cs | 52 +++++++++++++++++++ common/ASC.Core.Common/ASC.Core.Common.csproj | 2 +- .../ASC.Data.Backup.Core.csproj | 2 +- .../ASC.Data.Storage/ASC.Data.Storage.csproj | 2 +- .../ASC.FederatedLogin.csproj | 2 +- common/ASC.IPSecurity/ASC.IPSecurity.csproj | 2 +- common/ASC.VoipService/ASC.VoipService.csproj | 2 +- .../ASC.Webhooks.Core.csproj | 2 +- .../ASC.ApiSystem/ASC.ApiSystem.csproj | 3 ++ common/services/ASC.ApiSystem/Program.cs | 2 + common/services/ASC.ApiSystem/Startup.cs | 12 +++-- .../ASC.Data.Backup/ASC.Data.Backup.csproj | 3 ++ common/services/ASC.Data.Backup/Program.cs | 4 +- common/services/ASC.Data.Backup/Startup.cs | 4 ++ .../ASC.Data.Storage.Encryption.csproj | 5 +- .../ASC.Data.Storage.Encryption/Program.cs | 4 +- .../ASC.Data.Storage.Encryption/Startup.cs | 10 ++-- .../ASC.Data.Storage.Migration.csproj | 3 ++ .../ASC.Data.Storage.Migration/Program.cs | 12 ++++- .../ASC.ElasticSearch.csproj | 2 +- common/services/ASC.Notify/ASC.Notify.csproj | 3 ++ common/services/ASC.Notify/Program.cs | 7 +++ .../services/ASC.Radicale/ASC.Radicale.csproj | 3 ++ common/services/ASC.Radicale/Program.cs | 21 +++++--- .../ASC.Socket.IO.Svc.csproj | 3 ++ common/services/ASC.Socket.IO.Svc/Program.cs | 18 ++++--- .../ASC.SsoAuth.Svc/ASC.SsoAuth.Svc.csproj | 3 ++ common/services/ASC.SsoAuth.Svc/Program.cs | 21 +++++--- .../ASC.Studio.Notify.csproj | 3 ++ common/services/ASC.Studio.Notify/Program.cs | 8 +++ .../ASC.TelegramService.csproj | 3 ++ .../services/ASC.TelegramService/Program.cs | 4 +- .../services/ASC.TelegramService/Startup.cs | 14 +++-- .../ASC.Thumbnails.Svc.csproj | 3 ++ common/services/ASC.Thumbnails.Svc/Program.cs | 22 +++++--- .../ASC.UrlShortener.Svc.csproj | 3 ++ .../services/ASC.UrlShortener.Svc/Program.cs | 25 +++++---- .../ASC.Webhooks.Service.csproj | 3 ++ .../services/ASC.Webhooks.Service/Program.cs | 7 +++ config/redis.json | 13 +++++ .../ASC.CRM.BackgroundTasks.csproj | 5 ++ products/ASC.CRM/BackgroundTasks/Program.cs | 7 +++ products/ASC.CRM/Server/ASC.CRM.csproj | 5 +- products/ASC.CRM/Server/Program.cs | 2 + .../ASC.Calendar/Server/ASC.Calendar.csproj | 3 ++ products/ASC.Calendar/Server/Program.cs | 2 + products/ASC.Calendar/Server/Startup.cs | 7 +++ products/ASC.Files/Core/ASC.Files.Core.csproj | 2 +- products/ASC.Files/Server/ASC.Files.csproj | 3 ++ products/ASC.Files/Server/Program.cs | 2 + products/ASC.Files/Server/Startup.cs | 7 ++- .../Service/ASC.Files.Service.csproj | 3 ++ products/ASC.Files/Service/Program.cs | 7 +++ products/ASC.Mail/Server/ASC.Mail.csproj | 3 ++ products/ASC.Mail/Server/Program.cs | 2 + products/ASC.Mail/Server/Startup.cs | 5 ++ products/ASC.People/Server/ASC.People.csproj | 3 ++ products/ASC.People/Server/Program.cs | 2 + products/ASC.People/Server/Startup.cs | 15 ++++-- .../ASC.Projects/Server/ASC.Projects.csproj | 3 ++ products/ASC.Projects/Server/Program.cs | 2 + products/ASC.Projects/Server/Startup.cs | 5 ++ web/ASC.Web.Api/ASC.Web.Api.csproj | 3 ++ web/ASC.Web.Api/Program.cs | 2 + web/ASC.Web.Api/Startup.cs | 11 ++-- web/ASC.Web.Core/ASC.Web.Core.csproj | 2 +- web/ASC.Web.Studio/ASC.Web.Studio.csproj | 3 ++ web/ASC.Web.Studio/Program.cs | 2 + web/ASC.Web.Studio/Startup.cs | 9 +++- 71 files changed, 373 insertions(+), 79 deletions(-) create mode 100644 common/ASC.Common/Caching/RedisCache.cs create mode 100644 config/redis.json diff --git a/common/ASC.Api.Core/Core/BaseStartup.cs b/common/ASC.Api.Core/Core/BaseStartup.cs index 27f17952cf..8aba6302a0 100644 --- a/common/ASC.Api.Core/Core/BaseStartup.cs +++ b/common/ASC.Api.Core/Core/BaseStartup.cs @@ -34,6 +34,8 @@ using Microsoft.Extensions.Hosting; using NLog; using NLog.Extensions.Logging; +using StackExchange.Redis.Extensions.Core.Configuration; + namespace ASC.Api.Core { public abstract class BaseStartup diff --git a/common/ASC.Common/ASC.Common.csproj b/common/ASC.Common/ASC.Common.csproj index e589ba8664..b01185bd36 100644 --- a/common/ASC.Common/ASC.Common.csproj +++ b/common/ASC.Common/ASC.Common.csproj @@ -32,8 +32,8 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -55,6 +55,8 @@ --> + + diff --git a/common/ASC.Common/Caching/RedisCache.cs b/common/ASC.Common/Caching/RedisCache.cs new file mode 100644 index 0000000000..13df68cc56 --- /dev/null +++ b/common/ASC.Common/Caching/RedisCache.cs @@ -0,0 +1,52 @@ +/* + * + * (c) Copyright Ascensio System Limited 2010-2021 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + + +using System; +using System.Collections.Concurrent; +using Google.Protobuf; +using StackExchange.Redis.Extensions.Core.Abstractions; + +namespace ASC.Common.Caching; + +[Singletone] +public class RedisCache : ICacheNotify where T : IMessage, new() +{ + private readonly string CacheId = Guid.NewGuid().ToString(); + private readonly IRedisDatabase _redis; + private readonly ConcurrentDictionary>> actions = new ConcurrentDictionary>>(); + + public RedisCache(IRedisCacheClient redisCacheClient) + { + _redis = redisCacheClient.GetDbFromConfiguration(); + } + + public void Publish(T obj, CacheNotifyAction action) + { + throw new NotImplementedException(); + } + + public void Subscribe(Action onchange, CacheNotifyAction action) + { + throw new NotImplementedException(); + } + + public void Unsubscribe(CacheNotifyAction action) + { + throw new NotImplementedException(); + } + +} diff --git a/common/ASC.Core.Common/ASC.Core.Common.csproj b/common/ASC.Core.Common/ASC.Core.Common.csproj index 03472ef3f8..1a00e0b319 100644 --- a/common/ASC.Core.Common/ASC.Core.Common.csproj +++ b/common/ASC.Core.Common/ASC.Core.Common.csproj @@ -51,7 +51,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/common/ASC.Data.Backup.Core/ASC.Data.Backup.Core.csproj b/common/ASC.Data.Backup.Core/ASC.Data.Backup.Core.csproj index d8ca0f0d76..c58fa94e73 100644 --- a/common/ASC.Data.Backup.Core/ASC.Data.Backup.Core.csproj +++ b/common/ASC.Data.Backup.Core/ASC.Data.Backup.Core.csproj @@ -16,7 +16,7 @@ true - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/common/ASC.Data.Storage/ASC.Data.Storage.csproj b/common/ASC.Data.Storage/ASC.Data.Storage.csproj index a6e77e865c..3cdd7eb2cd 100644 --- a/common/ASC.Data.Storage/ASC.Data.Storage.csproj +++ b/common/ASC.Data.Storage/ASC.Data.Storage.csproj @@ -38,7 +38,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/common/ASC.FederatedLogin/ASC.FederatedLogin.csproj b/common/ASC.FederatedLogin/ASC.FederatedLogin.csproj index 8176a612b4..28cf4aa407 100644 --- a/common/ASC.FederatedLogin/ASC.FederatedLogin.csproj +++ b/common/ASC.FederatedLogin/ASC.FederatedLogin.csproj @@ -26,7 +26,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/common/ASC.IPSecurity/ASC.IPSecurity.csproj b/common/ASC.IPSecurity/ASC.IPSecurity.csproj index 292cea489d..2570bb72b2 100644 --- a/common/ASC.IPSecurity/ASC.IPSecurity.csproj +++ b/common/ASC.IPSecurity/ASC.IPSecurity.csproj @@ -14,7 +14,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/common/ASC.VoipService/ASC.VoipService.csproj b/common/ASC.VoipService/ASC.VoipService.csproj index 0d3f8982d8..54acd3e489 100644 --- a/common/ASC.VoipService/ASC.VoipService.csproj +++ b/common/ASC.VoipService/ASC.VoipService.csproj @@ -22,7 +22,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/common/ASC.Webhooks.Core/ASC.Webhooks.Core.csproj b/common/ASC.Webhooks.Core/ASC.Webhooks.Core.csproj index 757b905bcd..2797a3ea79 100644 --- a/common/ASC.Webhooks.Core/ASC.Webhooks.Core.csproj +++ b/common/ASC.Webhooks.Core/ASC.Webhooks.Core.csproj @@ -19,7 +19,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/common/services/ASC.ApiSystem/ASC.ApiSystem.csproj b/common/services/ASC.ApiSystem/ASC.ApiSystem.csproj index 1211611882..4557db05fd 100644 --- a/common/services/ASC.ApiSystem/ASC.ApiSystem.csproj +++ b/common/services/ASC.ApiSystem/ASC.ApiSystem.csproj @@ -20,6 +20,9 @@ + + + diff --git a/common/services/ASC.ApiSystem/Program.cs b/common/services/ASC.ApiSystem/Program.cs index e28b91f1e8..f719305901 100644 --- a/common/services/ASC.ApiSystem/Program.cs +++ b/common/services/ASC.ApiSystem/Program.cs @@ -93,6 +93,8 @@ namespace ASC.ApiSystem .AddJsonFile("storage.json") .AddJsonFile("kafka.json") .AddJsonFile($"kafka.{hostingContext.HostingEnvironment.EnvironmentName}.json", true) + .AddJsonFile("redis.json") + .AddJsonFile($"redis.{hostingContext.HostingEnvironment.EnvironmentName}.json", true) .AddEnvironmentVariables() .AddCommandLine(args) .AddInMemoryCollection(new Dictionary diff --git a/common/services/ASC.ApiSystem/Startup.cs b/common/services/ASC.ApiSystem/Startup.cs index e254403228..4712bec521 100644 --- a/common/services/ASC.ApiSystem/Startup.cs +++ b/common/services/ASC.ApiSystem/Startup.cs @@ -40,9 +40,11 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.HttpOverrides; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; - - +using Microsoft.Extensions.Hosting; + +using StackExchange.Redis.Extensions.Core.Configuration; +using StackExchange.Redis.Extensions.Newtonsoft; + namespace ASC.ApiSystem { public class Startup : BaseWorkerStartup @@ -82,7 +84,9 @@ namespace ASC.ApiSystem services.AddAuthentication() .AddScheme("auth.allowskip", _ => { }) - .AddScheme("auth.allowskip.registerportal", _ => { }); + .AddScheme("auth.allowskip.registerportal", _ => { }); + + services.AddStackExchangeRedisExtensions(Configuration.GetSection("Redis").Get()); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. diff --git a/common/services/ASC.Data.Backup/ASC.Data.Backup.csproj b/common/services/ASC.Data.Backup/ASC.Data.Backup.csproj index a497937491..9972a62996 100644 --- a/common/services/ASC.Data.Backup/ASC.Data.Backup.csproj +++ b/common/services/ASC.Data.Backup/ASC.Data.Backup.csproj @@ -24,6 +24,9 @@ + + + diff --git a/common/services/ASC.Data.Backup/Program.cs b/common/services/ASC.Data.Backup/Program.cs index ef4dcd44eb..80cc78036b 100644 --- a/common/services/ASC.Data.Backup/Program.cs +++ b/common/services/ASC.Data.Backup/Program.cs @@ -70,7 +70,9 @@ namespace ASC.Data.Backup .AddJsonFile($"notify.{env}.json", true) .AddJsonFile("backup.json") .AddJsonFile("kafka.json") - .AddJsonFile($"kafka.{env}.json", true) + .AddJsonFile($"kafka.{env}.json", true) + .AddJsonFile("redis.json") + .AddJsonFile($"redis.{env}.json", true) .AddEnvironmentVariables() .AddCommandLine(args) .AddInMemoryCollection(new Dictionary diff --git a/common/services/ASC.Data.Backup/Startup.cs b/common/services/ASC.Data.Backup/Startup.cs index a4a59493d7..755b494f12 100644 --- a/common/services/ASC.Data.Backup/Startup.cs +++ b/common/services/ASC.Data.Backup/Startup.cs @@ -34,6 +34,9 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; +using StackExchange.Redis.Extensions.Core.Configuration; +using StackExchange.Redis.Extensions.Newtonsoft; + namespace ASC.Data.Backup { public class Startup : BaseStartup @@ -58,6 +61,7 @@ namespace ASC.Data.Backup NotifyConfigurationExtension.Register(DIHelper); services.AddHostedService(); + services.AddStackExchangeRedisExtensions(Configuration.GetSection("Redis").Get()); } } } diff --git a/common/services/ASC.Data.Storage.Encryption/ASC.Data.Storage.Encryption.csproj b/common/services/ASC.Data.Storage.Encryption/ASC.Data.Storage.Encryption.csproj index 06320b6789..9217e5b15b 100644 --- a/common/services/ASC.Data.Storage.Encryption/ASC.Data.Storage.Encryption.csproj +++ b/common/services/ASC.Data.Storage.Encryption/ASC.Data.Storage.Encryption.csproj @@ -23,11 +23,14 @@ true - + all runtime; build; native; contentfiles; analyzers; buildtransitive + + + diff --git a/common/services/ASC.Data.Storage.Encryption/Program.cs b/common/services/ASC.Data.Storage.Encryption/Program.cs index cfb8ca7088..24017ce4d6 100644 --- a/common/services/ASC.Data.Storage.Encryption/Program.cs +++ b/common/services/ASC.Data.Storage.Encryption/Program.cs @@ -98,7 +98,9 @@ namespace ASC.Data.Storage.Encryption .AddJsonFile("notify.json") .AddJsonFile($"notify.{env}.json", true) .AddJsonFile("kafka.json") - .AddJsonFile($"kafka.{env}.json", true) + .AddJsonFile($"kafka.{env}.json", true) + .AddJsonFile("redis.json") + .AddJsonFile($"redis.{env}.json", true) .AddEnvironmentVariables(); }) .ConfigureNLogLogging(); diff --git a/common/services/ASC.Data.Storage.Encryption/Startup.cs b/common/services/ASC.Data.Storage.Encryption/Startup.cs index 38fcb19c81..b968301ebe 100644 --- a/common/services/ASC.Data.Storage.Encryption/Startup.cs +++ b/common/services/ASC.Data.Storage.Encryption/Startup.cs @@ -28,8 +28,11 @@ using ASC.Common; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; - +using Microsoft.Extensions.Hosting; + +using StackExchange.Redis.Extensions.Core.Configuration; +using StackExchange.Redis.Extensions.Newtonsoft; + namespace ASC.Data.Storage.Encryption { public class Startup : BaseStartup @@ -45,7 +48,8 @@ namespace ASC.Data.Storage.Encryption DIHelper.TryAdd(); - services.AddHostedService(); + services.AddHostedService(); + services.AddStackExchangeRedisExtensions(Configuration.GetSection("Redis").Get()); } } } diff --git a/common/services/ASC.Data.Storage.Migration/ASC.Data.Storage.Migration.csproj b/common/services/ASC.Data.Storage.Migration/ASC.Data.Storage.Migration.csproj index cbae83f112..1a2ff54ae2 100644 --- a/common/services/ASC.Data.Storage.Migration/ASC.Data.Storage.Migration.csproj +++ b/common/services/ASC.Data.Storage.Migration/ASC.Data.Storage.Migration.csproj @@ -10,6 +10,9 @@ + + + diff --git a/common/services/ASC.Data.Storage.Migration/Program.cs b/common/services/ASC.Data.Storage.Migration/Program.cs index 8a4f34357d..af98d76932 100644 --- a/common/services/ASC.Data.Storage.Migration/Program.cs +++ b/common/services/ASC.Data.Storage.Migration/Program.cs @@ -14,8 +14,11 @@ using Autofac.Extensions.DependencyInjection; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; - +using Microsoft.Extensions.Hosting; + +using StackExchange.Redis.Extensions.Core.Configuration; +using StackExchange.Redis.Extensions.Newtonsoft; + namespace ASC.Data.Storage.Migration { public class Program @@ -52,6 +55,8 @@ namespace ASC.Data.Storage.Migration .AddJsonFile($"notify.{env}.json", true) .AddJsonFile("kafka.json") .AddJsonFile($"kafka.{env}.json", true) + .AddJsonFile("redis.json") + .AddJsonFile($"redis.{env}.json", true) .AddEnvironmentVariables() .AddCommandLine(args) .AddInMemoryCollection(new Dictionary @@ -70,6 +75,9 @@ namespace ASC.Data.Storage.Migration diHelper.TryAdd(); services.AddHostedService(); + + services.AddStackExchangeRedisExtensions(hostContext.Configuration.GetSection("Redis").Get()); + }) .ConfigureContainer((context, builder) => { diff --git a/common/services/ASC.ElasticSearch/ASC.ElasticSearch.csproj b/common/services/ASC.ElasticSearch/ASC.ElasticSearch.csproj index 0fe01f7cfc..68f165c340 100644 --- a/common/services/ASC.ElasticSearch/ASC.ElasticSearch.csproj +++ b/common/services/ASC.ElasticSearch/ASC.ElasticSearch.csproj @@ -28,7 +28,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/common/services/ASC.Notify/ASC.Notify.csproj b/common/services/ASC.Notify/ASC.Notify.csproj index cdb92b566b..a40dc6103b 100644 --- a/common/services/ASC.Notify/ASC.Notify.csproj +++ b/common/services/ASC.Notify/ASC.Notify.csproj @@ -18,6 +18,9 @@ + + + diff --git a/common/services/ASC.Notify/Program.cs b/common/services/ASC.Notify/Program.cs index 9f6a50c95b..c60b366d61 100644 --- a/common/services/ASC.Notify/Program.cs +++ b/common/services/ASC.Notify/Program.cs @@ -18,6 +18,9 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; +using StackExchange.Redis.Extensions.Core.Configuration; +using StackExchange.Redis.Extensions.Newtonsoft; + namespace ASC.Notify { public class Program @@ -54,6 +57,8 @@ namespace ASC.Notify .AddJsonFile($"notify.{env}.json", true) .AddJsonFile("kafka.json") .AddJsonFile($"kafka.{env}.json", true) + .AddJsonFile("redis.json") + .AddJsonFile($"redis.{env}.json", true) .AddEnvironmentVariables() .AddCommandLine(args) .AddInMemoryCollection(new Dictionary @@ -79,6 +84,8 @@ namespace ASC.Notify diHelper.TryAdd(); // fix private services.AddHostedService(); + services.AddStackExchangeRedisExtensions(hostContext.Configuration.GetSection("Redis").Get()); + }) .ConfigureContainer((context, builder) => { diff --git a/common/services/ASC.Radicale/ASC.Radicale.csproj b/common/services/ASC.Radicale/ASC.Radicale.csproj index b9fe6acdfc..207b3c5688 100644 --- a/common/services/ASC.Radicale/ASC.Radicale.csproj +++ b/common/services/ASC.Radicale/ASC.Radicale.csproj @@ -22,6 +22,9 @@ + + + diff --git a/common/services/ASC.Radicale/Program.cs b/common/services/ASC.Radicale/Program.cs index 7c2233f604..801640257e 100644 --- a/common/services/ASC.Radicale/Program.cs +++ b/common/services/ASC.Radicale/Program.cs @@ -40,12 +40,15 @@ using Autofac.Extensions.DependencyInjection; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; - +using Microsoft.Extensions.Hosting; + +using StackExchange.Redis.Extensions.Core.Configuration; +using StackExchange.Redis.Extensions.Newtonsoft; + namespace ASC.Radicale +{ +public class Program { - public class Program - { public static async Task Main(string[] args) { var host = CreateHostBuilder(args).Build(); @@ -71,10 +74,12 @@ namespace ASC.Radicale config .AddJsonFile("appsettings.json") .AddJsonFile("storage.json") - .AddJsonFile("kafka.json") + .AddJsonFile("kafka.json") + .AddJsonFile($"kafka.{env}.json", true) + .AddJsonFile("redis.json") + .AddJsonFile($"redis.{env}.json", true) .AddJsonFile($"appsettings.services.json", true) //.AddJsonFile("radicale.json") - .AddJsonFile($"kafka.{env}.json", true) .AddJsonFile($"appsettings.{env}.json", true) .AddJsonFile($"radicale.{env}.json", true) .AddEnvironmentVariables() @@ -93,7 +98,9 @@ namespace ASC.Radicale diHelper.RegisterProducts(hostContext.Configuration, hostContext.HostingEnvironment.ContentRootPath); services.AddHostedService(); - diHelper.TryAdd(); + diHelper.TryAdd(); + + services.AddStackExchangeRedisExtensions(hostContext.Configuration.GetSection("Redis").Get()); }) .ConfigureContainer((context, builder) => { diff --git a/common/services/ASC.Socket.IO.Svc/ASC.Socket.IO.Svc.csproj b/common/services/ASC.Socket.IO.Svc/ASC.Socket.IO.Svc.csproj index 7cdc10fa69..2d5319095d 100644 --- a/common/services/ASC.Socket.IO.Svc/ASC.Socket.IO.Svc.csproj +++ b/common/services/ASC.Socket.IO.Svc/ASC.Socket.IO.Svc.csproj @@ -21,6 +21,9 @@ + + + diff --git a/common/services/ASC.Socket.IO.Svc/Program.cs b/common/services/ASC.Socket.IO.Svc/Program.cs index c231c363cf..1eca785a84 100644 --- a/common/services/ASC.Socket.IO.Svc/Program.cs +++ b/common/services/ASC.Socket.IO.Svc/Program.cs @@ -40,12 +40,14 @@ using Autofac.Extensions.DependencyInjection; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; - - +using Microsoft.Extensions.Hosting; + +using StackExchange.Redis.Extensions.Core.Configuration; +using StackExchange.Redis.Extensions.Newtonsoft; + namespace ASC.Socket.IO.Svc -{ - public class Program +{ +public class Program { public async static Task Main(string[] args) { @@ -74,8 +76,10 @@ namespace ASC.Socket.IO.Svc .AddJsonFile("appsettings.json") .AddJsonFile("storage.json") .AddJsonFile("kafka.json") - .AddJsonFile("socket.json") .AddJsonFile($"kafka.{env}.json", true) + .AddJsonFile("redis.json") + .AddJsonFile($"redis.{env}.json", true) + .AddJsonFile("socket.json") .AddJsonFile($"appsettings.{env}.json", true) .AddJsonFile($"socket.{env}.json", true) .AddEnvironmentVariables() @@ -95,6 +99,8 @@ namespace ASC.Socket.IO.Svc services.AddHostedService(); diHelper.TryAdd(); + + services.AddStackExchangeRedisExtensions(hostContext.Configuration.GetSection("Redis").Get()); }) .ConfigureContainer((context, builder) => { diff --git a/common/services/ASC.SsoAuth.Svc/ASC.SsoAuth.Svc.csproj b/common/services/ASC.SsoAuth.Svc/ASC.SsoAuth.Svc.csproj index b8311a3464..35da0476d5 100644 --- a/common/services/ASC.SsoAuth.Svc/ASC.SsoAuth.Svc.csproj +++ b/common/services/ASC.SsoAuth.Svc/ASC.SsoAuth.Svc.csproj @@ -21,6 +21,9 @@ + + + diff --git a/common/services/ASC.SsoAuth.Svc/Program.cs b/common/services/ASC.SsoAuth.Svc/Program.cs index 52fb9be582..f1281dd0f5 100644 --- a/common/services/ASC.SsoAuth.Svc/Program.cs +++ b/common/services/ASC.SsoAuth.Svc/Program.cs @@ -41,12 +41,14 @@ using Autofac.Extensions.DependencyInjection; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; - - +using Microsoft.Extensions.Hosting; + +using StackExchange.Redis.Extensions.Core.Configuration; +using StackExchange.Redis.Extensions.Newtonsoft; + namespace ASC.Socket.IO.Svc -{ - public class Program +{ +public class Program { public async static Task Main(string[] args) { @@ -74,9 +76,11 @@ namespace ASC.Socket.IO.Svc config .AddJsonFile("appsettings.json") .AddJsonFile("storage.json") - .AddJsonFile("kafka.json") + .AddJsonFile("kafka.json") + .AddJsonFile($"kafka.{env}.json", true) + .AddJsonFile("redis.json") + .AddJsonFile($"redis.{env}.json", true) .AddJsonFile("ssoauth.json") - .AddJsonFile($"kafka.{env}.json", true) .AddJsonFile($"appsettings.{env}.json", true) .AddJsonFile($"ssoauth.{env}.json", true) .AddEnvironmentVariables() @@ -96,6 +100,9 @@ namespace ASC.Socket.IO.Svc services.AddHostedService(); diHelper.TryAdd(); + + services.AddStackExchangeRedisExtensions(hostContext.Configuration.GetSection("Redis").Get()); + }) .ConfigureContainer((context, builder) => { diff --git a/common/services/ASC.Studio.Notify/ASC.Studio.Notify.csproj b/common/services/ASC.Studio.Notify/ASC.Studio.Notify.csproj index 6958d850d8..ac9f570e6c 100644 --- a/common/services/ASC.Studio.Notify/ASC.Studio.Notify.csproj +++ b/common/services/ASC.Studio.Notify/ASC.Studio.Notify.csproj @@ -16,6 +16,9 @@ + + + diff --git a/common/services/ASC.Studio.Notify/Program.cs b/common/services/ASC.Studio.Notify/Program.cs index 2d7ab1da66..d0d3d2a26f 100644 --- a/common/services/ASC.Studio.Notify/Program.cs +++ b/common/services/ASC.Studio.Notify/Program.cs @@ -19,6 +19,9 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; +using StackExchange.Redis.Extensions.Core.Configuration; +using StackExchange.Redis.Extensions.Newtonsoft; + namespace ASC.Studio.Notify { public class Program @@ -55,6 +58,8 @@ namespace ASC.Studio.Notify .AddJsonFile($"notify.{env}.json", true) .AddJsonFile("kafka.json") .AddJsonFile($"kafka.{env}.json", true) + .AddJsonFile("redis.json") + .AddJsonFile($"redis.{env}.json", true) .AddEnvironmentVariables() .AddCommandLine(args) .AddInMemoryCollection(new Dictionary @@ -73,6 +78,9 @@ namespace ASC.Studio.Notify diHelper.TryAdd(); NotifyConfigurationExtension.Register(diHelper); diHelper.TryAdd(); + + services.AddStackExchangeRedisExtensions(hostContext.Configuration.GetSection("Redis").Get()); + }) .ConfigureContainer((context, builder) => { diff --git a/common/services/ASC.TelegramService/ASC.TelegramService.csproj b/common/services/ASC.TelegramService/ASC.TelegramService.csproj index 93585acbd2..1fd54c18cc 100644 --- a/common/services/ASC.TelegramService/ASC.TelegramService.csproj +++ b/common/services/ASC.TelegramService/ASC.TelegramService.csproj @@ -18,6 +18,9 @@ + + + diff --git a/common/services/ASC.TelegramService/Program.cs b/common/services/ASC.TelegramService/Program.cs index cc2b79f536..8d75d54535 100644 --- a/common/services/ASC.TelegramService/Program.cs +++ b/common/services/ASC.TelegramService/Program.cs @@ -98,7 +98,9 @@ namespace ASC.TelegramService .AddJsonFile("notify.json") .AddJsonFile($"notify.{env}.json", true) .AddJsonFile("kafka.json") - .AddJsonFile($"kafka.{env}.json", true) + .AddJsonFile($"kafka.{env}.json", true) + .AddJsonFile("redis.json") + .AddJsonFile($"redis.{env}.json", true) .AddEnvironmentVariables(); }) .ConfigureNLogLogging(); diff --git a/common/services/ASC.TelegramService/Startup.cs b/common/services/ASC.TelegramService/Startup.cs index 7fa92ac86d..dae85e8181 100644 --- a/common/services/ASC.TelegramService/Startup.cs +++ b/common/services/ASC.TelegramService/Startup.cs @@ -28,11 +28,14 @@ using ASC.Common; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; - +using Microsoft.Extensions.Hosting; + +using StackExchange.Redis.Extensions.Core.Configuration; +using StackExchange.Redis.Extensions.Newtonsoft; + namespace ASC.TelegramService -{ - public class Startup : BaseStartup +{ + public class Startup : BaseStartup { public Startup(IConfiguration configuration, IHostEnvironment hostEnvironment) : base(configuration, hostEnvironment) { @@ -45,7 +48,8 @@ namespace ASC.TelegramService DIHelper.TryAdd(); - services.AddHostedService(); + services.AddHostedService(); + services.AddStackExchangeRedisExtensions(Configuration.GetSection("Redis").Get()); } } } diff --git a/common/services/ASC.Thumbnails.Svc/ASC.Thumbnails.Svc.csproj b/common/services/ASC.Thumbnails.Svc/ASC.Thumbnails.Svc.csproj index 7366c400fe..75d7fe8456 100644 --- a/common/services/ASC.Thumbnails.Svc/ASC.Thumbnails.Svc.csproj +++ b/common/services/ASC.Thumbnails.Svc/ASC.Thumbnails.Svc.csproj @@ -27,6 +27,9 @@ + + + \ No newline at end of file diff --git a/common/services/ASC.Thumbnails.Svc/Program.cs b/common/services/ASC.Thumbnails.Svc/Program.cs index a1543a6767..82e17a3582 100644 --- a/common/services/ASC.Thumbnails.Svc/Program.cs +++ b/common/services/ASC.Thumbnails.Svc/Program.cs @@ -40,12 +40,14 @@ using Autofac.Extensions.DependencyInjection; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; - - +using Microsoft.Extensions.Hosting; + +using StackExchange.Redis.Extensions.Core.Configuration; +using StackExchange.Redis.Extensions.Newtonsoft; + namespace ASC.Thumbnails.Svc -{ - public class Program +{ +public class Program { public async static Task Main(string[] args) { @@ -73,9 +75,11 @@ namespace ASC.Thumbnails.Svc config .AddJsonFile("appsettings.json") .AddJsonFile("storage.json") - .AddJsonFile("kafka.json") - .AddJsonFile("thumb.json") + .AddJsonFile("kafka.json") .AddJsonFile($"kafka.{env}.json", true) + .AddJsonFile("redis.json") + .AddJsonFile($"redis.{env}.json", true) + .AddJsonFile("thumb.json") .AddJsonFile($"appsettings.{env}.json", true) .AddJsonFile($"thumb.{env}.json", true) .AddEnvironmentVariables() @@ -93,7 +97,9 @@ namespace ASC.Thumbnails.Svc diHelper.TryAdd(typeof(ICacheNotify<>), typeof(KafkaCache<>)); services.AddHostedService(); - diHelper.TryAdd(); + diHelper.TryAdd(); + + services.AddStackExchangeRedisExtensions(hostContext.Configuration.GetSection("Redis").Get()); }) .ConfigureContainer((context, builder) => { diff --git a/common/services/ASC.UrlShortener.Svc/ASC.UrlShortener.Svc.csproj b/common/services/ASC.UrlShortener.Svc/ASC.UrlShortener.Svc.csproj index e0798a28ef..cd2a6f6d3c 100644 --- a/common/services/ASC.UrlShortener.Svc/ASC.UrlShortener.Svc.csproj +++ b/common/services/ASC.UrlShortener.Svc/ASC.UrlShortener.Svc.csproj @@ -18,6 +18,9 @@ + + + diff --git a/common/services/ASC.UrlShortener.Svc/Program.cs b/common/services/ASC.UrlShortener.Svc/Program.cs index f3a8c32cce..0a5dc6868d 100644 --- a/common/services/ASC.UrlShortener.Svc/Program.cs +++ b/common/services/ASC.UrlShortener.Svc/Program.cs @@ -39,15 +39,17 @@ using Autofac.Extensions.DependencyInjection; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; - - +using Microsoft.Extensions.Hosting; + +using StackExchange.Redis.Extensions.Core.Configuration; +using StackExchange.Redis.Extensions.Newtonsoft; + namespace ASC.UrlShortener.Svc -{ - public class Program - { - public async static Task Main(string[] args) - { +{ +public class Program +{ +public async static Task Main(string[] args) +{ var host = CreateHostBuilder(args).Build(); await host.RunAsync(); @@ -79,6 +81,8 @@ namespace ASC.UrlShortener.Svc .AddJsonFile("storage.json") .AddJsonFile("kafka.json") .AddJsonFile($"kafka.{env}.json", true) + .AddJsonFile("redis.json") + .AddJsonFile($"redis.{env}.json", true) .AddEnvironmentVariables() .AddCommandLine(args) .AddInMemoryCollection(new Dictionary @@ -94,7 +98,10 @@ namespace ASC.UrlShortener.Svc var diHelper = new DIHelper(services); services.AddHostedService(); - diHelper.TryAdd(); + diHelper.TryAdd(); + + services.AddStackExchangeRedisExtensions(hostContext.Configuration.GetSection("Redis").Get()); + }) .ConfigureContainer((context, builder) => { diff --git a/common/services/ASC.Webhooks.Service/ASC.Webhooks.Service.csproj b/common/services/ASC.Webhooks.Service/ASC.Webhooks.Service.csproj index 2096dea798..9266649028 100644 --- a/common/services/ASC.Webhooks.Service/ASC.Webhooks.Service.csproj +++ b/common/services/ASC.Webhooks.Service/ASC.Webhooks.Service.csproj @@ -8,6 +8,9 @@ + + + diff --git a/common/services/ASC.Webhooks.Service/Program.cs b/common/services/ASC.Webhooks.Service/Program.cs index 1fdd02c81a..1d5024d949 100644 --- a/common/services/ASC.Webhooks.Service/Program.cs +++ b/common/services/ASC.Webhooks.Service/Program.cs @@ -17,6 +17,9 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; +using StackExchange.Redis.Extensions.Core.Configuration; +using StackExchange.Redis.Extensions.Newtonsoft; + namespace ASC.Webhooks.Service { public class Program @@ -56,6 +59,8 @@ namespace ASC.Webhooks.Service .AddJsonFile("storage.json") .AddJsonFile("kafka.json") .AddJsonFile($"kafka.{env}.json", true) + .AddJsonFile("redis.json") + .AddJsonFile($"redis.{env}.json", true) .AddEnvironmentVariables() .AddCommandLine(args); }) @@ -71,6 +76,8 @@ namespace ASC.Webhooks.Service services.AddHostedService(); diHelper.TryAdd(); + + services.AddStackExchangeRedisExtensions(hostContext.Configuration.GetSection("Redis").Get()); }) .ConfigureContainer((context, builder) => { diff --git a/config/redis.json b/config/redis.json new file mode 100644 index 0000000000..8a81e18154 --- /dev/null +++ b/config/redis.json @@ -0,0 +1,13 @@ +{ + "Redis": { + "Ssl": false, + "ConnectTimeout": 60000, + "ConnectRetry": 2, + "Database": 0, + "Hosts": [ + { + "Host": "127.0.0.1", + "Port": "6379" + }] + } +} \ No newline at end of file diff --git a/products/ASC.CRM/BackgroundTasks/ASC.CRM.BackgroundTasks.csproj b/products/ASC.CRM/BackgroundTasks/ASC.CRM.BackgroundTasks.csproj index dab536c2bf..a0a75eedc3 100644 --- a/products/ASC.CRM/BackgroundTasks/ASC.CRM.BackgroundTasks.csproj +++ b/products/ASC.CRM/BackgroundTasks/ASC.CRM.BackgroundTasks.csproj @@ -3,6 +3,11 @@ net6.0 false + + + + + diff --git a/products/ASC.CRM/BackgroundTasks/Program.cs b/products/ASC.CRM/BackgroundTasks/Program.cs index 197b3b3e0a..a44b7c7756 100644 --- a/products/ASC.CRM/BackgroundTasks/Program.cs +++ b/products/ASC.CRM/BackgroundTasks/Program.cs @@ -17,6 +17,8 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; +using StackExchange.Redis.Extensions.Core.Configuration; +using StackExchange.Redis.Extensions.Newtonsoft; namespace ASC.CRM.BackgroundTasks { @@ -58,6 +60,8 @@ namespace ASC.CRM.BackgroundTasks .AddJsonFile($"notify.{env}.json", true) .AddJsonFile("kafka.json") .AddJsonFile($"kafka.{env}.json", true) + .AddJsonFile("redis.json") + .AddJsonFile($"redis.{env}.json", true) .AddEnvironmentVariables() .AddCommandLine(args); }) @@ -81,6 +85,9 @@ namespace ASC.CRM.BackgroundTasks diHelper.TryAdd(); diHelper.TryAdd(); diHelper.TryAdd(); + + services.AddStackExchangeRedisExtensions(hostContext.Configuration.GetSection("Redis").Get()); + }) .ConfigureContainer((context, builder) => { diff --git a/products/ASC.CRM/Server/ASC.CRM.csproj b/products/ASC.CRM/Server/ASC.CRM.csproj index 5f55544984..1c101eec62 100644 --- a/products/ASC.CRM/Server/ASC.CRM.csproj +++ b/products/ASC.CRM/Server/ASC.CRM.csproj @@ -37,12 +37,15 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive + + + diff --git a/products/ASC.CRM/Server/Program.cs b/products/ASC.CRM/Server/Program.cs index b2613fdcb9..7893ad8861 100644 --- a/products/ASC.CRM/Server/Program.cs +++ b/products/ASC.CRM/Server/Program.cs @@ -67,6 +67,8 @@ namespace ASC.CRM .AddJsonFile("storage.json") .AddJsonFile("kafka.json") .AddJsonFile($"kafka.{hostingContext.HostingEnvironment.EnvironmentName}.json", true) + .AddJsonFile("redis.json") + .AddJsonFile($"redis.{hostingContext.HostingEnvironment.EnvironmentName}.json", true) .AddEnvironmentVariables() .AddCommandLine(args) .AddInMemoryCollection(new Dictionary diff --git a/products/ASC.Calendar/Server/ASC.Calendar.csproj b/products/ASC.Calendar/Server/ASC.Calendar.csproj index 4b66ffcc18..29e14ec2c2 100644 --- a/products/ASC.Calendar/Server/ASC.Calendar.csproj +++ b/products/ASC.Calendar/Server/ASC.Calendar.csproj @@ -21,6 +21,9 @@ + + + diff --git a/products/ASC.Calendar/Server/Program.cs b/products/ASC.Calendar/Server/Program.cs index fcf2433e55..b5f2138077 100644 --- a/products/ASC.Calendar/Server/Program.cs +++ b/products/ASC.Calendar/Server/Program.cs @@ -73,6 +73,8 @@ namespace ASC.Calendar .AddJsonFile("storage.json") .AddJsonFile("kafka.json") .AddJsonFile($"kafka.{hostingContext.HostingEnvironment.EnvironmentName}.json", true) + .AddJsonFile("redis.json") + .AddJsonFile($"redis.{hostingContext.HostingEnvironment.EnvironmentName}.json", true) .AddEnvironmentVariables() .AddCommandLine(args) .AddInMemoryCollection(new Dictionary diff --git a/products/ASC.Calendar/Server/Startup.cs b/products/ASC.Calendar/Server/Startup.cs index b6de24882e..dc74d91909 100644 --- a/products/ASC.Calendar/Server/Startup.cs +++ b/products/ASC.Calendar/Server/Startup.cs @@ -11,6 +11,10 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; +using StackExchange.Redis.Extensions.Core.Configuration; + +using StackExchange.Redis.Extensions.Newtonsoft; + namespace ASC.Calendar { public class Startup : BaseStartup @@ -39,6 +43,9 @@ namespace ASC.Calendar DIHelper.TryAdd(); NotifyConfigurationExtension.Register(DIHelper); + + services.AddStackExchangeRedisExtensions(Configuration.GetSection("Redis").Get()); + } public override void Configure(IApplicationBuilder app, IWebHostEnvironment env) diff --git a/products/ASC.Files/Core/ASC.Files.Core.csproj b/products/ASC.Files/Core/ASC.Files.Core.csproj index a865c361b9..ade48cd4af 100644 --- a/products/ASC.Files/Core/ASC.Files.Core.csproj +++ b/products/ASC.Files/Core/ASC.Files.Core.csproj @@ -23,7 +23,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/products/ASC.Files/Server/ASC.Files.csproj b/products/ASC.Files/Server/ASC.Files.csproj index 63b21a2e37..cf66d7e36f 100644 --- a/products/ASC.Files/Server/ASC.Files.csproj +++ b/products/ASC.Files/Server/ASC.Files.csproj @@ -21,6 +21,9 @@ + + + diff --git a/products/ASC.Files/Server/Program.cs b/products/ASC.Files/Server/Program.cs index 302baa18db..ec928e616c 100644 --- a/products/ASC.Files/Server/Program.cs +++ b/products/ASC.Files/Server/Program.cs @@ -73,6 +73,8 @@ namespace ASC.Files .AddJsonFile("storage.json") .AddJsonFile("kafka.json") .AddJsonFile($"kafka.{hostingContext.HostingEnvironment.EnvironmentName}.json", true) + .AddJsonFile("redis.json") + .AddJsonFile($"redis.{hostingContext.HostingEnvironment.EnvironmentName}.json", true) .AddEnvironmentVariables() .AddCommandLine(args) .AddInMemoryCollection(new Dictionary diff --git a/products/ASC.Files/Server/Startup.cs b/products/ASC.Files/Server/Startup.cs index aa20ff056a..bd5e7b825c 100644 --- a/products/ASC.Files/Server/Startup.cs +++ b/products/ASC.Files/Server/Startup.cs @@ -11,7 +11,10 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Hosting; + +using StackExchange.Redis.Extensions.Core.Configuration; +using StackExchange.Redis.Extensions.Newtonsoft; namespace ASC.Files { @@ -41,6 +44,8 @@ namespace ASC.Files DIHelper.TryAdd(); NotifyConfigurationExtension.Register(DIHelper); + + services.AddStackExchangeRedisExtensions(Configuration.GetSection("Redis").Get()); } public override void Configure(IApplicationBuilder app, IWebHostEnvironment env) diff --git a/products/ASC.Files/Service/ASC.Files.Service.csproj b/products/ASC.Files/Service/ASC.Files.Service.csproj index eb812ca123..f399329722 100644 --- a/products/ASC.Files/Service/ASC.Files.Service.csproj +++ b/products/ASC.Files/Service/ASC.Files.Service.csproj @@ -16,6 +16,9 @@ + + + diff --git a/products/ASC.Files/Service/Program.cs b/products/ASC.Files/Service/Program.cs index e4c4d7e261..6712c6c193 100644 --- a/products/ASC.Files/Service/Program.cs +++ b/products/ASC.Files/Service/Program.cs @@ -20,6 +20,9 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; +using StackExchange.Redis.Extensions.Core.Configuration; +using StackExchange.Redis.Extensions.Newtonsoft; + namespace ASC.Files.Service { public class Program @@ -56,6 +59,8 @@ namespace ASC.Files.Service .AddJsonFile($"notify.{env}.json", true) .AddJsonFile("kafka.json") .AddJsonFile($"kafka.{env}.json", true) + .AddJsonFile("redis.json") + .AddJsonFile($"redis.{env}.json", true) .AddJsonFile("elastic.json", true) .AddEnvironmentVariables() .AddCommandLine(args) @@ -95,6 +100,8 @@ namespace ASC.Files.Service services.AddHostedService(); diHelper.TryAdd(); + services.AddStackExchangeRedisExtensions(hostContext.Configuration.GetSection("Redis").Get()); + }) .ConfigureContainer((context, builder) => { diff --git a/products/ASC.Mail/Server/ASC.Mail.csproj b/products/ASC.Mail/Server/ASC.Mail.csproj index ac741f5d8a..b503cc76f2 100644 --- a/products/ASC.Mail/Server/ASC.Mail.csproj +++ b/products/ASC.Mail/Server/ASC.Mail.csproj @@ -10,6 +10,9 @@ + + + diff --git a/products/ASC.Mail/Server/Program.cs b/products/ASC.Mail/Server/Program.cs index c20c70705c..f1acc198a7 100644 --- a/products/ASC.Mail/Server/Program.cs +++ b/products/ASC.Mail/Server/Program.cs @@ -47,6 +47,8 @@ namespace ASC.Mail .AddJsonFile("storage.json") .AddJsonFile("kafka.json") .AddJsonFile($"kafka.{hostingContext.HostingEnvironment.EnvironmentName}.json", true) + .AddJsonFile("redis.json") + .AddJsonFile($"redis.{hostingContext.HostingEnvironment.EnvironmentName}.json", true) .AddEnvironmentVariables() .AddCommandLine(args) .AddInMemoryCollection(new Dictionary diff --git a/products/ASC.Mail/Server/Startup.cs b/products/ASC.Mail/Server/Startup.cs index 0d09a61471..75335e52e7 100644 --- a/products/ASC.Mail/Server/Startup.cs +++ b/products/ASC.Mail/Server/Startup.cs @@ -9,6 +9,9 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; +using StackExchange.Redis.Extensions.Core.Configuration; +using StackExchange.Redis.Extensions.Newtonsoft; + namespace ASC.Mail { public class Startup : BaseStartup @@ -24,6 +27,8 @@ namespace ASC.Mail Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); base.ConfigureServices(services); + + services.AddStackExchangeRedisExtensions(Configuration.GetSection("Redis").Get()); } public override void Configure(IApplicationBuilder app, IWebHostEnvironment env) diff --git a/products/ASC.People/Server/ASC.People.csproj b/products/ASC.People/Server/ASC.People.csproj index 27c2945ebb..96c5e4f7c4 100644 --- a/products/ASC.People/Server/ASC.People.csproj +++ b/products/ASC.People/Server/ASC.People.csproj @@ -26,6 +26,9 @@ + + + diff --git a/products/ASC.People/Server/Program.cs b/products/ASC.People/Server/Program.cs index 12409ef8af..4017ed5863 100644 --- a/products/ASC.People/Server/Program.cs +++ b/products/ASC.People/Server/Program.cs @@ -69,6 +69,8 @@ namespace ASC.People .AddJsonFile("storage.json") .AddJsonFile("kafka.json") .AddJsonFile($"kafka.{hostingContext.HostingEnvironment.EnvironmentName}.json", true) + .AddJsonFile("redis.json") + .AddJsonFile($"redis.{hostingContext.HostingEnvironment.EnvironmentName}.json", true) .AddEnvironmentVariables() .AddCommandLine(args) .AddInMemoryCollection(new Dictionary diff --git a/products/ASC.People/Server/Startup.cs b/products/ASC.People/Server/Startup.cs index 927fd8a7d0..ab1340ced5 100644 --- a/products/ASC.People/Server/Startup.cs +++ b/products/ASC.People/Server/Startup.cs @@ -5,11 +5,14 @@ using ASC.Employee.Core.Controllers; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; - +using Microsoft.Extensions.Hosting; + +using StackExchange.Redis.Extensions.Core.Configuration; +using StackExchange.Redis.Extensions.Newtonsoft; + namespace ASC.People -{ - public class Startup : BaseStartup +{ +public class Startup : BaseStartup { public override bool ConfirmAddScheme { get => true; } @@ -22,7 +25,9 @@ namespace ASC.People base.ConfigureServices(services); DIHelper.TryAdd(); - DIHelper.TryAdd(); + DIHelper.TryAdd(); + + services.AddStackExchangeRedisExtensions(Configuration.GetSection("Redis").Get()); } } } \ No newline at end of file diff --git a/products/ASC.Projects/Server/ASC.Projects.csproj b/products/ASC.Projects/Server/ASC.Projects.csproj index 37e034f792..756189b99c 100644 --- a/products/ASC.Projects/Server/ASC.Projects.csproj +++ b/products/ASC.Projects/Server/ASC.Projects.csproj @@ -10,6 +10,9 @@ + + + diff --git a/products/ASC.Projects/Server/Program.cs b/products/ASC.Projects/Server/Program.cs index c7d02eb957..07ea75208f 100644 --- a/products/ASC.Projects/Server/Program.cs +++ b/products/ASC.Projects/Server/Program.cs @@ -69,6 +69,8 @@ namespace ASC.Projects .AddJsonFile("storage.json") .AddJsonFile("kafka.json") .AddJsonFile($"kafka.{hostingContext.HostingEnvironment.EnvironmentName}.json", true) + .AddJsonFile("redis.json") + .AddJsonFile($"redis.{hostingContext.HostingEnvironment.EnvironmentName}.json", true) .AddEnvironmentVariables() .AddCommandLine(args) .AddInMemoryCollection(new Dictionary diff --git a/products/ASC.Projects/Server/Startup.cs b/products/ASC.Projects/Server/Startup.cs index 7470890b4d..3d5e35b627 100644 --- a/products/ASC.Projects/Server/Startup.cs +++ b/products/ASC.Projects/Server/Startup.cs @@ -9,6 +9,9 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; +using StackExchange.Redis.Extensions.Core.Configuration; +using StackExchange.Redis.Extensions.Newtonsoft; + namespace ASC.Projects { public class Startup : BaseStartup @@ -24,6 +27,8 @@ namespace ASC.Projects Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); base.ConfigureServices(services); + + services.AddStackExchangeRedisExtensions(Configuration.GetSection("Redis").Get()); } public override void Configure(IApplicationBuilder app, IWebHostEnvironment env) diff --git a/web/ASC.Web.Api/ASC.Web.Api.csproj b/web/ASC.Web.Api/ASC.Web.Api.csproj index 86fd6999fd..a4ae0b8919 100644 --- a/web/ASC.Web.Api/ASC.Web.Api.csproj +++ b/web/ASC.Web.Api/ASC.Web.Api.csproj @@ -24,6 +24,9 @@ + + + diff --git a/web/ASC.Web.Api/Program.cs b/web/ASC.Web.Api/Program.cs index f79fc93f87..836553f1dc 100644 --- a/web/ASC.Web.Api/Program.cs +++ b/web/ASC.Web.Api/Program.cs @@ -68,6 +68,8 @@ namespace ASC.Web.Api .AddJsonFile("storage.json") .AddJsonFile("kafka.json") .AddJsonFile($"kafka.{hostingContext.HostingEnvironment.EnvironmentName}.json", true) + .AddJsonFile("redis.json") + .AddJsonFile($"redis.{hostingContext.HostingEnvironment.EnvironmentName}.json", true) .AddEnvironmentVariables() .AddCommandLine(args) .AddInMemoryCollection(new Dictionary diff --git a/web/ASC.Web.Api/Startup.cs b/web/ASC.Web.Api/Startup.cs index eecedb371a..9290236b37 100644 --- a/web/ASC.Web.Api/Startup.cs +++ b/web/ASC.Web.Api/Startup.cs @@ -5,8 +5,11 @@ using ASC.Web.Api.Controllers; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; - +using Microsoft.Extensions.Hosting; + +using StackExchange.Redis.Extensions.Core.Configuration; +using StackExchange.Redis.Extensions.Newtonsoft; + namespace ASC.Web.Api { public class Startup : BaseStartup @@ -30,7 +33,9 @@ namespace ASC.Web.Api DIHelper.TryAdd(); DIHelper.TryAdd(); DIHelper.TryAdd(); - DIHelper.TryAdd(); + DIHelper.TryAdd(); + + services.AddStackExchangeRedisExtensions(Configuration.GetSection("Redis").Get()); } } } diff --git a/web/ASC.Web.Core/ASC.Web.Core.csproj b/web/ASC.Web.Core/ASC.Web.Core.csproj index 49684aba69..520e3c4ff2 100644 --- a/web/ASC.Web.Core/ASC.Web.Core.csproj +++ b/web/ASC.Web.Core/ASC.Web.Core.csproj @@ -212,7 +212,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/web/ASC.Web.Studio/ASC.Web.Studio.csproj b/web/ASC.Web.Studio/ASC.Web.Studio.csproj index e4a7429970..7310eeafb0 100644 --- a/web/ASC.Web.Studio/ASC.Web.Studio.csproj +++ b/web/ASC.Web.Studio/ASC.Web.Studio.csproj @@ -17,6 +17,9 @@ + + + diff --git a/web/ASC.Web.Studio/Program.cs b/web/ASC.Web.Studio/Program.cs index fb8a125ffb..4c09f77e21 100644 --- a/web/ASC.Web.Studio/Program.cs +++ b/web/ASC.Web.Studio/Program.cs @@ -68,6 +68,8 @@ namespace ASC.Web.Studio .AddJsonFile("storage.json") .AddJsonFile("kafka.json") .AddJsonFile($"kafka.{hostingContext.HostingEnvironment.EnvironmentName}.json", true) + .AddJsonFile("redis.json") + .AddJsonFile($"redis.{hostingContext.HostingEnvironment.EnvironmentName}.json", true) .AddEnvironmentVariables() .AddCommandLine(args) .AddInMemoryCollection(new Dictionary diff --git a/web/ASC.Web.Studio/Startup.cs b/web/ASC.Web.Studio/Startup.cs index 7dfd55a8e7..304e70ef11 100644 --- a/web/ASC.Web.Studio/Startup.cs +++ b/web/ASC.Web.Studio/Startup.cs @@ -10,8 +10,11 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.HttpOverrides; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; - +using Microsoft.Extensions.Hosting; + +using StackExchange.Redis.Extensions.Core.Configuration; +using StackExchange.Redis.Extensions.Newtonsoft; + namespace ASC.Web.Studio { public class Startup : BaseStartup @@ -33,6 +36,8 @@ namespace ASC.Web.Studio DIHelper.TryAdd(); DIHelper.TryAdd(); DIHelper.TryAdd(); + + services.AddStackExchangeRedisExtensions(Configuration.GetSection("Redis").Get()); } public override void Configure(IApplicationBuilder app, IWebHostEnvironment env) From dcc7986a909b2d9c80b15c80544f78f5f9c6cbfb Mon Sep 17 00:00:00 2001 From: Alexey Bannov Date: Thu, 23 Dec 2021 18:27:58 +0300 Subject: [PATCH 02/11] map ICacheNotify<> to RedisCache<> --- common/ASC.Api.Core/Core/BaseStartup.cs | 2 +- common/services/ASC.ApiSystem/Startup.cs | 2 +- common/services/ASC.ClearEvents/Program.cs | 2 +- common/services/ASC.Data.Storage.Migration/Program.cs | 2 +- common/services/ASC.Notify/Program.cs | 2 +- common/services/ASC.Radicale/Program.cs | 2 +- common/services/ASC.Socket.IO.Svc/Program.cs | 2 +- common/services/ASC.SsoAuth.Svc/Program.cs | 2 +- common/services/ASC.Studio.Notify/Program.cs | 2 +- common/services/ASC.Thumbnails.Svc/Program.cs | 2 +- common/services/ASC.Webhooks.Service/Program.cs | 2 +- products/ASC.CRM/BackgroundTasks/Program.cs | 2 +- products/ASC.Files/Service/Program.cs | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/common/ASC.Api.Core/Core/BaseStartup.cs b/common/ASC.Api.Core/Core/BaseStartup.cs index 8aba6302a0..18e1e21c44 100644 --- a/common/ASC.Api.Core/Core/BaseStartup.cs +++ b/common/ASC.Api.Core/Core/BaseStartup.cs @@ -103,7 +103,7 @@ namespace ASC.Api.Core DIHelper.TryAdd(); DIHelper.TryAdd(); - DIHelper.TryAdd(typeof(ICacheNotify<>), typeof(KafkaCache<>)); + DIHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); DIHelper.TryAdd(typeof(IWebhookPublisher), typeof(WebhookPublisher)); if (LoadProducts) diff --git a/common/services/ASC.ApiSystem/Startup.cs b/common/services/ASC.ApiSystem/Startup.cs index 4712bec521..f303f4dddb 100644 --- a/common/services/ASC.ApiSystem/Startup.cs +++ b/common/services/ASC.ApiSystem/Startup.cs @@ -75,7 +75,7 @@ namespace ASC.ApiSystem services.AddMemoryCache(); - diHelper.TryAdd(typeof(ICacheNotify<>), typeof(KafkaCache<>)); + diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); diHelper.TryAdd(); diHelper.TryAdd(); diHelper.TryAdd(); diff --git a/common/services/ASC.ClearEvents/Program.cs b/common/services/ASC.ClearEvents/Program.cs index 2214cf7600..ebfc508e07 100644 --- a/common/services/ASC.ClearEvents/Program.cs +++ b/common/services/ASC.ClearEvents/Program.cs @@ -83,7 +83,7 @@ namespace ASC.Thumbnails.Svc services.AddMemoryCache(); var diHelper = new DIHelper(services); - diHelper.TryAdd(typeof(ICacheNotify<>), typeof(KafkaCache<>)); + diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); services.AddHostedService(); diHelper.TryAdd(); }) diff --git a/common/services/ASC.Data.Storage.Migration/Program.cs b/common/services/ASC.Data.Storage.Migration/Program.cs index af98d76932..f130a609d8 100644 --- a/common/services/ASC.Data.Storage.Migration/Program.cs +++ b/common/services/ASC.Data.Storage.Migration/Program.cs @@ -69,7 +69,7 @@ namespace ASC.Data.Storage.Migration { services.AddMemoryCache(); var diHelper = new DIHelper(services); - diHelper.TryAdd(typeof(ICacheNotify<>), typeof(KafkaCache<>)); + diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); diHelper.RegisterProducts(hostContext.Configuration, hostContext.HostingEnvironment.ContentRootPath); diff --git a/common/services/ASC.Notify/Program.cs b/common/services/ASC.Notify/Program.cs index c60b366d61..68c94ad7bc 100644 --- a/common/services/ASC.Notify/Program.cs +++ b/common/services/ASC.Notify/Program.cs @@ -72,7 +72,7 @@ namespace ASC.Notify services.AddMemoryCache(); var diHelper = new DIHelper(services); - diHelper.TryAdd(typeof(ICacheNotify<>), typeof(KafkaCache<>)); + diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); diHelper.RegisterProducts(hostContext.Configuration, hostContext.HostingEnvironment.ContentRootPath); services.Configure(hostContext.Configuration.GetSection("notify")); diff --git a/common/services/ASC.Radicale/Program.cs b/common/services/ASC.Radicale/Program.cs index 801640257e..736f0fd53e 100644 --- a/common/services/ASC.Radicale/Program.cs +++ b/common/services/ASC.Radicale/Program.cs @@ -94,7 +94,7 @@ public class Program { services.AddMemoryCache(); var diHelper = new DIHelper(services); - diHelper.TryAdd(typeof(ICacheNotify<>), typeof(KafkaCache<>)); + diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); diHelper.RegisterProducts(hostContext.Configuration, hostContext.HostingEnvironment.ContentRootPath); services.AddHostedService(); diff --git a/common/services/ASC.Socket.IO.Svc/Program.cs b/common/services/ASC.Socket.IO.Svc/Program.cs index 1eca785a84..04d6d7ded6 100644 --- a/common/services/ASC.Socket.IO.Svc/Program.cs +++ b/common/services/ASC.Socket.IO.Svc/Program.cs @@ -94,7 +94,7 @@ public class Program { services.AddMemoryCache(); var diHelper = new DIHelper(services); - diHelper.TryAdd(typeof(ICacheNotify<>), typeof(KafkaCache<>)); + diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); diHelper.RegisterProducts(hostContext.Configuration, hostContext.HostingEnvironment.ContentRootPath); services.AddHostedService(); diff --git a/common/services/ASC.SsoAuth.Svc/Program.cs b/common/services/ASC.SsoAuth.Svc/Program.cs index f1281dd0f5..64e264bcb6 100644 --- a/common/services/ASC.SsoAuth.Svc/Program.cs +++ b/common/services/ASC.SsoAuth.Svc/Program.cs @@ -95,7 +95,7 @@ public class Program { services.AddMemoryCache(); var diHelper = new DIHelper(services); - diHelper.TryAdd(typeof(ICacheNotify<>), typeof(KafkaCache<>)); + diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); diHelper.RegisterProducts(hostContext.Configuration, hostContext.HostingEnvironment.ContentRootPath); services.AddHostedService(); diff --git a/common/services/ASC.Studio.Notify/Program.cs b/common/services/ASC.Studio.Notify/Program.cs index d0d3d2a26f..c054cd4f71 100644 --- a/common/services/ASC.Studio.Notify/Program.cs +++ b/common/services/ASC.Studio.Notify/Program.cs @@ -72,7 +72,7 @@ namespace ASC.Studio.Notify { services.AddMemoryCache(); var diHelper = new DIHelper(services); - diHelper.TryAdd(typeof(ICacheNotify<>), typeof(KafkaCache<>)); + diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); diHelper.RegisterProducts(hostContext.Configuration, hostContext.HostingEnvironment.ContentRootPath); services.AddHostedService(); diHelper.TryAdd(); diff --git a/common/services/ASC.Thumbnails.Svc/Program.cs b/common/services/ASC.Thumbnails.Svc/Program.cs index 82e17a3582..c99269d343 100644 --- a/common/services/ASC.Thumbnails.Svc/Program.cs +++ b/common/services/ASC.Thumbnails.Svc/Program.cs @@ -95,7 +95,7 @@ public class Program services.AddMemoryCache(); var diHelper = new DIHelper(services); - diHelper.TryAdd(typeof(ICacheNotify<>), typeof(KafkaCache<>)); + diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); services.AddHostedService(); diHelper.TryAdd(); diff --git a/common/services/ASC.Webhooks.Service/Program.cs b/common/services/ASC.Webhooks.Service/Program.cs index 1d5024d949..080039a05d 100644 --- a/common/services/ASC.Webhooks.Service/Program.cs +++ b/common/services/ASC.Webhooks.Service/Program.cs @@ -70,7 +70,7 @@ namespace ASC.Webhooks.Service var diHelper = new DIHelper(services); - diHelper.TryAdd(typeof(ICacheNotify<>), typeof(KafkaCache<>)); + diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); diHelper.TryAdd(); diff --git a/products/ASC.CRM/BackgroundTasks/Program.cs b/products/ASC.CRM/BackgroundTasks/Program.cs index a44b7c7756..8dce9babea 100644 --- a/products/ASC.CRM/BackgroundTasks/Program.cs +++ b/products/ASC.CRM/BackgroundTasks/Program.cs @@ -71,7 +71,7 @@ namespace ASC.CRM.BackgroundTasks var diHelper = new DIHelper(services); - diHelper.TryAdd(typeof(ICacheNotify<>), typeof(KafkaCache<>)); + diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); diHelper.RegisterProducts(hostContext.Configuration, hostContext.HostingEnvironment.ContentRootPath); diff --git a/products/ASC.Files/Service/Program.cs b/products/ASC.Files/Service/Program.cs index 6712c6c193..d22e60940d 100644 --- a/products/ASC.Files/Service/Program.cs +++ b/products/ASC.Files/Service/Program.cs @@ -76,7 +76,7 @@ namespace ASC.Files.Service var diHelper = new DIHelper(services); - diHelper.TryAdd(typeof(ICacheNotify<>), typeof(KafkaCache<>)); + diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); diHelper.RegisterProducts(hostContext.Configuration, hostContext.HostingEnvironment.ContentRootPath); From eb02c9669786c685af423d0f6b2ce45e1c706fe8 Mon Sep 17 00:00:00 2001 From: Alexey Bannov Date: Thu, 23 Dec 2021 18:29:35 +0300 Subject: [PATCH 03/11] microsoft recomended store the System.Guid type as string type in protobuf format --- common/ASC.Common/Caching/AscCache.cs | 2 +- common/ASC.Common/Caching/KafkaCache.cs | 4 +- common/ASC.Common/Caching/RedisCache.cs | 63 ++++++++++++++++++- common/ASC.Common/protos/AscCacheItem.proto | 2 +- .../Caching/CachedUserService.cs | 6 +- common/ASC.Core.Common/Core/UserGroupRef.cs | 8 +-- .../protos/UserGroupRefCacheItem.proto | 4 +- .../protos/UserInfoCacheItem.proto | 2 +- web/ASC.Web.Core/Users/UserPhotoManager.cs | 8 +-- .../protos/UserPhotoManagerCacheItem.proto | 2 +- 10 files changed, 79 insertions(+), 22 deletions(-) diff --git a/common/ASC.Common/Caching/AscCache.cs b/common/ASC.Common/Caching/AscCache.cs index 8b593c00f5..2a62898ad2 100644 --- a/common/ASC.Common/Caching/AscCache.cs +++ b/common/ASC.Common/Caching/AscCache.cs @@ -50,7 +50,7 @@ namespace ASC.Common.Caching public void ClearCache() { - CacheNotify.Publish(new AscCacheItem { Id = ByteString.CopyFrom(Guid.NewGuid().ToByteArray()) }, CacheNotifyAction.Any); + CacheNotify.Publish(new AscCacheItem { Id = Guid.NewGuid().ToString() }, CacheNotifyAction.Any); } public static void OnClearCache() diff --git a/common/ASC.Common/Caching/KafkaCache.cs b/common/ASC.Common/Caching/KafkaCache.cs index 2931de38e1..c753c67e64 100644 --- a/common/ASC.Common/Caching/KafkaCache.cs +++ b/common/ASC.Common/Caching/KafkaCache.cs @@ -84,7 +84,7 @@ namespace ASC.Common.Caching Value = obj, Key = new AscCacheItem { - Id = ByteString.CopyFrom(Key.ToByteArray()) + Id = Key.ToString() } }; @@ -159,7 +159,7 @@ namespace ASC.Common.Caching try { var cr = c.Consume(Cts[channelName].Token); - if (cr != null && cr.Message != null && cr.Message.Value != null && !(new Guid(cr.Message.Key.Id.ToByteArray())).Equals(Key) && Actions.TryGetValue(channelName, out var act)) + if (cr != null && cr.Message != null && cr.Message.Value != null && !(new Guid(cr.Message.Key.Id)).Equals(Key) && Actions.TryGetValue(channelName, out var act)) { try { diff --git a/common/ASC.Common/Caching/RedisCache.cs b/common/ASC.Common/Caching/RedisCache.cs index 13df68cc56..73b216ee85 100644 --- a/common/ASC.Common/Caching/RedisCache.cs +++ b/common/ASC.Common/Caching/RedisCache.cs @@ -17,7 +17,11 @@ using System; using System.Collections.Concurrent; +using System.Linq; +using System.Threading.Tasks; + using Google.Protobuf; + using StackExchange.Redis.Extensions.Core.Abstractions; namespace ASC.Common.Caching; @@ -36,17 +40,70 @@ public class RedisCache : ICacheNotify where T : IMessage, new() public void Publish(T obj, CacheNotifyAction action) { - throw new NotImplementedException(); + Task.Run(() => _redis.PublishAsync("asc:channel:" + typeof(T).FullName, new RedisCachePubSubItem() { CacheId = CacheId, Object = obj, Action = action })) + .GetAwaiter() + .GetResult(); + + ConcurrentBag> onchange; + actions.TryGetValue(typeof(T), out onchange); + + if (onchange != null) + { + onchange.ToList().ForEach(r => r(obj, action)); + } } public void Subscribe(Action onchange, CacheNotifyAction action) { - throw new NotImplementedException(); + Task.Run(() => _redis.SubscribeAsync>("asc:channel:" + typeof(T).FullName, (i) => + { + if (i.CacheId != CacheId) + { + onchange(i.Object); + } + + return Task.FromResult(true); + })).GetAwaiter() + .GetResult(); + + + if (onchange != null) + { + Action _action = (o, a) => onchange((T)o); + + actions.AddOrUpdate(typeof(T), + new ConcurrentBag> { _action }, + (type, bag) => + { + bag.Add(_action); + return bag; + }); + } + else + { + ConcurrentBag> removed; + actions.TryRemove(typeof(T), out removed); + } } public void Unsubscribe(CacheNotifyAction action) { - throw new NotImplementedException(); + Task.Run(() => _redis.UnsubscribeAsync>("asc:channel:" + typeof(T).FullName, (i) => + { + return Task.FromResult(true); + })).GetAwaiter() + .GetResult(); } + class RedisCachePubSubItem + { + public string CacheId { get; set; } + + public T0 Object { get; set; } + + public CacheNotifyAction Action { get; set; } + } } + + + diff --git a/common/ASC.Common/protos/AscCacheItem.proto b/common/ASC.Common/protos/AscCacheItem.proto index 8fbd2e7cfb..74b59401b2 100644 --- a/common/ASC.Common/protos/AscCacheItem.proto +++ b/common/ASC.Common/protos/AscCacheItem.proto @@ -3,5 +3,5 @@ package ASC.Common; message AscCacheItem { - bytes Id = 1; + string Id = 1; } \ No newline at end of file diff --git a/common/ASC.Core.Common/Caching/CachedUserService.cs b/common/ASC.Core.Common/Caching/CachedUserService.cs index 6be6a6de18..78bf07aedd 100644 --- a/common/ASC.Core.Common/Caching/CachedUserService.cs +++ b/common/ASC.Core.Common/Caching/CachedUserService.cs @@ -85,7 +85,7 @@ namespace ASC.Core.Caching { if (userInfo != null) { - var key = GetUserCacheKey(userInfo.Tenant, userInfo.ID.FromByteString()); + var key = GetUserCacheKey(userInfo.Tenant, new Guid(userInfo.ID)); Cache.Remove(key); } } @@ -271,14 +271,14 @@ namespace ASC.Core.Caching public UserInfo SaveUser(int tenant, UserInfo user) { user = Service.SaveUser(tenant, user); - CacheUserInfoItem.Publish(new UserInfoCacheItem { ID = user.ID.ToByteString(), Tenant = tenant }, CacheNotifyAction.Any); + CacheUserInfoItem.Publish(new UserInfoCacheItem { ID = user.ID.ToString(), Tenant = tenant }, CacheNotifyAction.Any); return user; } public void RemoveUser(int tenant, Guid id) { Service.RemoveUser(tenant, id); - CacheUserInfoItem.Publish(new UserInfoCacheItem { Tenant = tenant, ID = id.ToByteString() }, CacheNotifyAction.Any); + CacheUserInfoItem.Publish(new UserInfoCacheItem { Tenant = tenant, ID = id.ToString() }, CacheNotifyAction.Any); } public byte[] GetUserPhoto(int tenant, Guid id) diff --git a/common/ASC.Core.Common/Core/UserGroupRef.cs b/common/ASC.Core.Common/Core/UserGroupRef.cs index 38a9c6593d..7b7fc291da 100644 --- a/common/ASC.Core.Common/Core/UserGroupRef.cs +++ b/common/ASC.Core.Common/Core/UserGroupRef.cs @@ -83,8 +83,8 @@ namespace ASC.Core { var result = new UserGroupRef { - UserId = cache.UserId.FromByteString(), - GroupId = cache.GroupId.FromByteString() + UserId = new Guid(cache.UserId), + GroupId = new Guid(cache.GroupId) }; if (Enum.TryParse(cache.RefType, out var refType)) @@ -103,8 +103,8 @@ namespace ASC.Core { return new UserGroupRefCacheItem { - GroupId = cache.GroupId.ToByteString(), - UserId = cache.UserId.ToByteString(), + GroupId = cache.GroupId.ToString(), + UserId = cache.UserId.ToString(), RefType = cache.RefType.ToString(), LastModified = cache.LastModified.Ticks, Removed = cache.Removed, diff --git a/common/ASC.Core.Common/protos/UserGroupRefCacheItem.proto b/common/ASC.Core.Common/protos/UserGroupRefCacheItem.proto index bd86dae496..0c894c1601 100644 --- a/common/ASC.Core.Common/protos/UserGroupRefCacheItem.proto +++ b/common/ASC.Core.Common/protos/UserGroupRefCacheItem.proto @@ -3,8 +3,8 @@ package ASC.Core.Caching; message UserGroupRefCacheItem { - bytes UserId = 1; - bytes GroupId = 2; + string UserId = 1; + string GroupId = 2; bool Removed = 3; string RefType = 4; int64 LastModified = 5; diff --git a/common/ASC.Core.Common/protos/UserInfoCacheItem.proto b/common/ASC.Core.Common/protos/UserInfoCacheItem.proto index 5f19f1d139..14ac3fc2ed 100644 --- a/common/ASC.Core.Common/protos/UserInfoCacheItem.proto +++ b/common/ASC.Core.Common/protos/UserInfoCacheItem.proto @@ -3,6 +3,6 @@ package ASC.Core.Caching; message UserInfoCacheItem { - bytes ID = 1; + string ID = 1; int32 Tenant = 2; } \ No newline at end of file diff --git a/web/ASC.Web.Core/Users/UserPhotoManager.cs b/web/ASC.Web.Core/Users/UserPhotoManager.cs index e60b91b47a..cf6748101c 100644 --- a/web/ASC.Web.Core/Users/UserPhotoManager.cs +++ b/web/ASC.Web.Core/Users/UserPhotoManager.cs @@ -117,13 +117,13 @@ namespace ASC.Web.Core.Users CacheNotify.Subscribe((data) => { - var userId = new Guid(data.UserID.ToByteArray()); + var userId = new Guid(data.UserID); Photofiles.GetOrAdd(data.Size, (r) => new ConcurrentDictionary())[userId] = data.FileName; }, CacheNotifyAction.InsertOrUpdate); CacheNotify.Subscribe((data) => { - var userId = new Guid(data.UserID.ToByteArray()); + var userId = new Guid(data.UserID); try { @@ -157,7 +157,7 @@ namespace ASC.Web.Core.Users { if (CacheNotify != null) { - CacheNotify.Publish(new UserPhotoManagerCacheItem { UserID = Google.Protobuf.ByteString.CopyFrom(userID.ToByteArray()) }, CacheNotifyAction.Remove); + CacheNotify.Publish(new UserPhotoManagerCacheItem { UserID = userID.ToString() }, CacheNotifyAction.Remove); } } @@ -165,7 +165,7 @@ namespace ASC.Web.Core.Users { if (CacheNotify != null) { - CacheNotify.Publish(new UserPhotoManagerCacheItem { UserID = Google.Protobuf.ByteString.CopyFrom(userID.ToByteArray()), Size = UserPhotoManager.ToCache(size), FileName = fileName }, CacheNotifyAction.InsertOrUpdate); + CacheNotify.Publish(new UserPhotoManagerCacheItem { UserID = userID.ToString(), Size = UserPhotoManager.ToCache(size), FileName = fileName }, CacheNotifyAction.InsertOrUpdate); } } diff --git a/web/ASC.Web.Core/protos/UserPhotoManagerCacheItem.proto b/web/ASC.Web.Core/protos/UserPhotoManagerCacheItem.proto index c3391acf93..20c7798614 100644 --- a/web/ASC.Web.Core/protos/UserPhotoManagerCacheItem.proto +++ b/web/ASC.Web.Core/protos/UserPhotoManagerCacheItem.proto @@ -3,7 +3,7 @@ package ASC.Web.Core.Users; message UserPhotoManagerCacheItem { - bytes UserID = 1; + string UserID = 1; CacheSize Size = 2; From 04ff8d38dce954ad0e72d11aed587d635e8ef700 Mon Sep 17 00:00:00 2001 From: Alexey Bannov Date: Fri, 24 Dec 2021 16:47:37 +0300 Subject: [PATCH 04/11] refactoring build scripts --- build/build.backend.bat | 36 ++++++++++++++++++++++------------ build/build.static.bat | 2 +- build/buildAndDeploy.bat | 10 +++------- build/scripts/urlshortener.bat | 2 +- 4 files changed, 28 insertions(+), 22 deletions(-) diff --git a/build/build.backend.bat b/build/build.backend.bat index a0b36d3589..ff31327afd 100644 --- a/build/build.backend.bat +++ b/build/build.backend.bat @@ -1,23 +1,33 @@ @echo off -PUSHD %~dp0.. -dotnet build ASC.Web.slnf /fl1 /flp1:LogFile=build/ASC.Web.log;Verbosity=Normal -echo. -echo Install nodejs projects dependencies... +echo Start build backend... echo. +cd /D "%~dp0" +call runasadmin.bat "%~dpnx0" + if %errorlevel% == 0 ( - for /R "build\scripts\" %%f in (*.bat) do ( - echo Run script %%~nxf... - echo. - call build\scripts\%%~nxf - ) +call start\stop.bat nopause +dotnet build ..\asc.web.slnf /fl1 /flp1:logfile=asc.web.log;verbosity=normal +echo. + +call start\start.bat nopause + +echo install nodejs projects dependencies... +echo. + + +for /R "scripts\" %%f in (*.bat) do ( + echo Run script %%~nxf... + echo. + call scripts\%%~nxf ) echo. -POPD - -if "%1"=="nopause" goto start +if "%1"=="nopause" goto end pause -:start \ No newline at end of file + +) + +:end \ No newline at end of file diff --git a/build/build.static.bat b/build/build.static.bat index 6d6b2c4df8..da765bc336 100644 --- a/build/build.static.bat +++ b/build/build.static.bat @@ -1,6 +1,6 @@ @echo off -PUSHD %~dp0 +cd /D "%~dp0" call runasadmin.bat "%~dpnx0" if %errorlevel% == 0 ( diff --git a/build/buildAndDeploy.bat b/build/buildAndDeploy.bat index d47fe076f8..643da68383 100644 --- a/build/buildAndDeploy.bat +++ b/build/buildAndDeploy.bat @@ -6,14 +6,11 @@ echo "##########################################################" echo. -PUSHD %~dp0 -setlocal EnableDelayedExpansion - +cd /D "%~dp0" call runasadmin.bat "%~dpnx0" if %errorlevel% == 0 ( -call start\stop.bat nopause echo "FRONT-END static" call build.static.bat nopause @@ -21,9 +18,8 @@ call build.static.bat nopause echo "BACK-END" call build.backend.bat nopause -call start\start.bat nopause - echo. pause -) \ No newline at end of file + +) diff --git a/build/scripts/urlshortener.bat b/build/scripts/urlshortener.bat index 6215530f9f..de73870bc3 100644 --- a/build/scripts/urlshortener.bat +++ b/build/scripts/urlshortener.bat @@ -1 +1 @@ -yarn install --cwd common/ASC.UrlShortener/ --frozen-lockfile \ No newline at end of file +yarn install --cwd %~dp0../../common/ASC.UrlShortener/ --frozen-lockfile \ No newline at end of file From a7dc8c7dfd242a41b2884fa3f6a3e7021e3df139 Mon Sep 17 00:00:00 2001 From: Alexey Bannov Date: Thu, 30 Dec 2021 18:09:20 +0300 Subject: [PATCH 05/11] sync CommunityServer and AppServer cache via redis --- common/ASC.Common/Caching/RedisCache.cs | 49 ++++------------------ config/redis.json | 3 +- web/ASC.Web.Core/Users/UserPhotoManager.cs | 26 ++++++------ 3 files changed, 23 insertions(+), 55 deletions(-) diff --git a/common/ASC.Common/Caching/RedisCache.cs b/common/ASC.Common/Caching/RedisCache.cs index 73b216ee85..611831a7be 100644 --- a/common/ASC.Common/Caching/RedisCache.cs +++ b/common/ASC.Common/Caching/RedisCache.cs @@ -16,8 +16,6 @@ using System; -using System.Collections.Concurrent; -using System.Linq; using System.Threading.Tasks; using Google.Protobuf; @@ -29,9 +27,7 @@ namespace ASC.Common.Caching; [Singletone] public class RedisCache : ICacheNotify where T : IMessage, new() { - private readonly string CacheId = Guid.NewGuid().ToString(); private readonly IRedisDatabase _redis; - private readonly ConcurrentDictionary>> actions = new ConcurrentDictionary>>(); public RedisCache(IRedisCacheClient redisCacheClient) { @@ -40,65 +36,38 @@ public class RedisCache : ICacheNotify where T : IMessage, new() public void Publish(T obj, CacheNotifyAction action) { - Task.Run(() => _redis.PublishAsync("asc:channel:" + typeof(T).FullName, new RedisCachePubSubItem() { CacheId = CacheId, Object = obj, Action = action })) + Task.Run(() => _redis.PublishAsync(GetChannelName(action), new RedisCachePubSubItem() { Object = obj, Action = action })) .GetAwaiter() .GetResult(); - - ConcurrentBag> onchange; - actions.TryGetValue(typeof(T), out onchange); - - if (onchange != null) - { - onchange.ToList().ForEach(r => r(obj, action)); - } } public void Subscribe(Action onchange, CacheNotifyAction action) { - Task.Run(() => _redis.SubscribeAsync>("asc:channel:" + typeof(T).FullName, (i) => + Task.Run(() => _redis.SubscribeAsync>(GetChannelName(action), (i) => { - if (i.CacheId != CacheId) - { - onchange(i.Object); - } + onchange(i.Object); return Task.FromResult(true); })).GetAwaiter() .GetResult(); - - - if (onchange != null) - { - Action _action = (o, a) => onchange((T)o); - - actions.AddOrUpdate(typeof(T), - new ConcurrentBag> { _action }, - (type, bag) => - { - bag.Add(_action); - return bag; - }); - } - else - { - ConcurrentBag> removed; - actions.TryRemove(typeof(T), out removed); - } } public void Unsubscribe(CacheNotifyAction action) { - Task.Run(() => _redis.UnsubscribeAsync>("asc:channel:" + typeof(T).FullName, (i) => + Task.Run(() => _redis.UnsubscribeAsync>(GetChannelName(action), (i) => { return Task.FromResult(true); })).GetAwaiter() .GetResult(); } + private string GetChannelName(CacheNotifyAction cacheNotifyAction) + { + return $"asc:channel:{cacheNotifyAction}:{typeof(T).FullName}".ToLower(); + } + class RedisCachePubSubItem { - public string CacheId { get; set; } - public T0 Object { get; set; } public CacheNotifyAction Action { get; set; } diff --git a/config/redis.json b/config/redis.json index 8a81e18154..fb4f128368 100644 --- a/config/redis.json +++ b/config/redis.json @@ -1,7 +1,8 @@ { "Redis": { "Ssl": false, - "ConnectTimeout": 60000, + "ConnectTimeout": 5000, + "SyncTimeout": 60000, "ConnectRetry": 2, "Database": 0, "Hosts": [ diff --git a/web/ASC.Web.Core/Users/UserPhotoManager.cs b/web/ASC.Web.Core/Users/UserPhotoManager.cs index cf6748101c..f2a96a1521 100644 --- a/web/ASC.Web.Core/Users/UserPhotoManager.cs +++ b/web/ASC.Web.Core/Users/UserPhotoManager.cs @@ -153,19 +153,19 @@ namespace ASC.Web.Core.Users return isLoaded ? TenantDiskCache.Add(tenantId) : TenantDiskCache.Remove(tenantId); } - public void ClearCache(Guid userID) + public void ClearCache(Guid userID, int tenantId) { if (CacheNotify != null) { - CacheNotify.Publish(new UserPhotoManagerCacheItem { UserID = userID.ToString() }, CacheNotifyAction.Remove); + CacheNotify.Publish(new UserPhotoManagerCacheItem { UserID = userID.ToString(), TenantId = tenantId }, CacheNotifyAction.Remove); } } - public void AddToCache(Guid userID, Size size, string fileName) + public void AddToCache(Guid userID, Size size, string fileName, int tenantId) { if (CacheNotify != null) { - CacheNotify.Publish(new UserPhotoManagerCacheItem { UserID = userID.ToString(), Size = UserPhotoManager.ToCache(size), FileName = fileName }, CacheNotifyAction.InsertOrUpdate); + CacheNotify.Publish(new UserPhotoManagerCacheItem { UserID = userID.ToString(), Size = UserPhotoManager.ToCache(size), FileName = fileName, TenantId = tenantId }, CacheNotifyAction.InsertOrUpdate); } } @@ -326,8 +326,6 @@ namespace ASC.Web.Core.Users return defaultRetinaPhotoURL ??= GetDefaultPhotoAbsoluteWebPath(RetinaFotoSize); } - - public static Size OriginalFotoSize { get; } = new Size(1280, 1280); public static Size RetinaFotoSize { get; } = new Size(360, 360); @@ -375,7 +373,7 @@ namespace ASC.Web.Core.Users photoUrl = SaveOrUpdatePhoto(userID, data, -1, new Size(-1, -1), false, out fileName); } - UserPhotoManagerCache.AddToCache(userID, Size.Empty, fileName); + UserPhotoManagerCache.AddToCache(userID, Size.Empty, fileName, tenant.TenantId); return photoUrl; } @@ -422,7 +420,7 @@ namespace ASC.Web.Core.Users //empty photo. cache default var photoUrl = GetDefaultPhotoAbsoluteWebPath(size); - UserPhotoManagerCache.AddToCache(userID, size, "default"); + UserPhotoManagerCache.AddToCache(userID, size, "default", tenant.TenantId); isdef = true; return photoUrl; } @@ -501,7 +499,7 @@ namespace ASC.Web.Core.Users //Parse size size = new Size(int.Parse(match.Groups["width"].Value), int.Parse(match.Groups["height"].Value)); } - UserPhotoManagerCache.AddToCache(parsedUserId, size, fileName); + UserPhotoManagerCache.AddToCache(parsedUserId, size, fileName, tenant.TenantId); } } } @@ -539,7 +537,7 @@ namespace ASC.Web.Core.Users } UserManager.SaveUserPhoto(idUser, null); - UserPhotoManagerCache.ClearCache(idUser); + UserPhotoManagerCache.ClearCache(idUser, tenant.TenantId); } public void SyncPhoto(Guid userID, byte[] data) @@ -547,7 +545,7 @@ namespace ASC.Web.Core.Users data = TryParseImage(data, -1, OriginalFotoSize, out _, out int width, out int height); UserManager.SaveUserPhoto(userID, data); SetUserPhotoThumbnailSettings(userID, width, height); - UserPhotoManagerCache.ClearCache(userID); + UserPhotoManagerCache.ClearCache(userID, tenant.TenantId); } @@ -562,7 +560,7 @@ namespace ASC.Web.Core.Users { UserManager.SaveUserPhoto(userID, data); SetUserPhotoThumbnailSettings(userID, width, height); - UserPhotoManagerCache.ClearCache(userID); + UserPhotoManagerCache.ClearCache(userID, tenant.TenantId); } @@ -731,7 +729,7 @@ namespace ASC.Web.Core.Users using var stream2 = new MemoryStream(data); item.DataStore.Save(fileName, stream2).ToString(); - UserPhotoManagerCache.AddToCache(item.UserId, item.Size, fileName); + UserPhotoManagerCache.AddToCache(item.UserId, item.Size, fileName, tenant.TenantId); } catch (ArgumentException error) { @@ -844,7 +842,7 @@ namespace ASC.Web.Core.Users photoUrl = store.Save(fileName, s).ToString(); } - UserPhotoManagerCache.AddToCache(userID, size, fileName); + UserPhotoManagerCache.AddToCache(userID, size, fileName, tenant.TenantId); return photoUrl; } From efb51c613f77cc5e6899c8e3702e71438b98ff72 Mon Sep 17 00:00:00 2001 From: Alexey Bannov Date: Tue, 11 Jan 2022 19:28:48 +0300 Subject: [PATCH 06/11] refactoring *.proto files according to https://bit.ly/3KcZ0Ef --- common/ASC.Common/ASC.Common.csproj | 8 +- .../protos/DistributedTaskCache.proto | 21 ------ common/ASC.Common/protos/NotifyItem.proto | 32 -------- ...scCacheItem.proto => asc_cache_item.proto} | 12 +-- .../protos/distributed_task_cache.proto | 21 ++++++ ...oto => distributed_task_cancelation.proto} | 12 +-- common/ASC.Common/protos/notify_item.proto | 32 ++++++++ common/ASC.Core.Common/ASC.Core.Common.csproj | 74 +++++++++---------- .../Caching/CachedUserService.cs | 10 +-- .../Notify/Model/NotifyAction.cs | 4 +- .../protos/AzRecordCache.proto | 15 ---- .../protos/CreateClientProto.proto | 11 --- .../protos/EncryptionSettingsProto.proto | 17 ----- .../ASC.Core.Common/protos/NotifyInvoke.proto | 10 --- .../protos/NotifyMessage.proto | 23 ------ .../protos/SubscriptionMethodCache.proto | 15 ---- .../protos/SubscriptionRecord.proto | 17 ----- .../protos/UserGroupRefCacheItem.proto | 12 --- .../protos/az_record_cache.proto | 15 ++++ ...heItem.proto => consumer_cache_item.proto} | 14 ++-- .../protos/create_client_proto.proto | 11 +++ ...Proto.proto => disable_client_proto.proto} | 2 +- .../protos/encryption_settings_proto.proto | 17 +++++ ...CacheItem.proto => group_cache_item.proto} | 12 +-- .../protos/notify_invoke.proto | 10 +++ .../protos/notify_message.proto | 23 ++++++ ...CacheItem.proto => quota_cache_item.proto} | 12 +-- ...rProto.proto => register_user_proto.proto} | 6 +- ...heItem.proto => settings_cache_item.proto} | 12 +-- .../protos/subscription_method_cache.proto | 15 ++++ .../protos/subscription_record.proto | 17 +++++ ...acheItem.proto => tariff_cache_item.proto} | 12 +-- ...acheItem.proto => tenant_cache_item.proto} | 12 +-- ...nantSetting.proto => tenant_setting.proto} | 12 +-- .../protos/user_group_ref_cache_item.proto | 12 +++ ...eItem.proto => user_info_cache_item.proto} | 14 ++-- ...Item.proto => user_photo_cache_item.proto} | 12 +-- .../ASC.Data.Backup.Core.csproj | 8 +- .../protos/BackupProgress.proto | 18 ----- .../protos/backup_progress.proto | 18 +++++ ...teSchedule.proto => delete_schedule.proto} | 2 +- .../ASC.Data.Storage/ASC.Data.Storage.csproj | 22 +++--- .../Migration/MigrateServiceClient.cs | 4 +- .../protos/MigrationProgress.proto | 11 --- .../protos/MigrationUploadCdn.proto | 16 ---- ...Item.proto => data_store_cache_item.proto} | 14 ++-- ...yptionStop.proto => encryption_stop.proto} | 0 ...ationCache.proto => migration_cache.proto} | 8 +- .../protos/migration_progress.proto | 11 +++ .../protos/migration_upload_cdn.proto | 16 ++++ ...yption.proto => progress_encryption.proto} | 4 +- .../ASC.FederatedLogin.csproj | 2 +- ...acheItem.proto => linker_cache_item.proto} | 12 +-- common/ASC.IPSecurity/ASC.IPSecurity.csproj | 2 +- ...onItem.proto => ip_restriction_item.proto} | 10 +-- common/ASC.VoipService/ASC.VoipService.csproj | 2 +- ...dVoipItem.proto => cached_voip_item.proto} | 10 +-- .../ASC.Webhooks.Core.csproj | 4 +- ...ookRequest.proto => webhook_request.proto} | 2 +- .../ASC.ElasticSearch.csproj | 4 +- .../ASC.ElasticSearch/protos/SearchItem.proto | 17 ----- .../protos/search_item.proto | 17 +++++ config/storage.json | 2 +- products/ASC.CRM/Server/ASC.CRM.csproj | 2 +- ...=> contact_photo_manager_cache_item.proto} | 0 products/ASC.Files/Core/ASC.Files.Core.csproj | 28 +++---- .../ASC.Files/Core/proto/BoxCacheItem.proto | 10 --- .../Core/proto/DropboxCacheItem.proto | 10 --- .../Core/proto/GoogleDriveCacheItem.proto | 12 --- .../Core/proto/ThumbnailRequest.proto | 9 --- .../ASC.Files/Core/proto/box_cache_item.proto | 10 +++ .../Core/proto/dropbox_cache_item.proto | 10 +++ .../Core/proto/google_drive_cache_item.proto | 12 +++ ...eItem.proto => one_drive_cache_item.proto} | 4 +- ...roto => provider_account_cache_item.proto} | 2 +- ... => share_point_provider_cache_item.proto} | 4 +- .../Core/proto/thumbnail_request.proto | 9 +++ web/ASC.Web.Core/ASC.Web.Core.csproj | 10 +-- .../Notify/StudioNotifyServiceHelper.cs | 4 +- .../Notify/StudioNotifyServiceSender.cs | 4 +- web/ASC.Web.Core/Users/UserPhotoManager.cs | 8 +- .../protos/UserPhotoManagerCacheItem.proto | 22 ------ ....proto => mail_service_helper_cache.proto} | 14 ++-- ...CacheKey.proto => sms_key_cache_key.proto} | 14 ++-- ...tem.proto => tenant_logo_cache_item.proto} | 14 ++-- .../user_photo_manager_cache_item.proto | 19 +++++ ...proto => web_item_security_notifier.proto} | 14 ++-- 87 files changed, 532 insertions(+), 535 deletions(-) delete mode 100644 common/ASC.Common/protos/DistributedTaskCache.proto delete mode 100644 common/ASC.Common/protos/NotifyItem.proto rename common/ASC.Common/protos/{AscCacheItem.proto => asc_cache_item.proto} (73%) create mode 100644 common/ASC.Common/protos/distributed_task_cache.proto rename common/ASC.Common/protos/{DistributedTaskCancelation.proto => distributed_task_cancelation.proto} (78%) create mode 100644 common/ASC.Common/protos/notify_item.proto delete mode 100644 common/ASC.Core.Common/protos/AzRecordCache.proto delete mode 100644 common/ASC.Core.Common/protos/CreateClientProto.proto delete mode 100644 common/ASC.Core.Common/protos/EncryptionSettingsProto.proto delete mode 100644 common/ASC.Core.Common/protos/NotifyInvoke.proto delete mode 100644 common/ASC.Core.Common/protos/NotifyMessage.proto delete mode 100644 common/ASC.Core.Common/protos/SubscriptionMethodCache.proto delete mode 100644 common/ASC.Core.Common/protos/SubscriptionRecord.proto delete mode 100644 common/ASC.Core.Common/protos/UserGroupRefCacheItem.proto create mode 100644 common/ASC.Core.Common/protos/az_record_cache.proto rename common/ASC.Core.Common/protos/{ConsumerCacheItem.proto => consumer_cache_item.proto} (63%) create mode 100644 common/ASC.Core.Common/protos/create_client_proto.proto rename common/ASC.Core.Common/protos/{DisableClientProto.proto => disable_client_proto.proto} (78%) create mode 100644 common/ASC.Core.Common/protos/encryption_settings_proto.proto rename common/ASC.Core.Common/protos/{GroupCacheItem.proto => group_cache_item.proto} (74%) create mode 100644 common/ASC.Core.Common/protos/notify_invoke.proto create mode 100644 common/ASC.Core.Common/protos/notify_message.proto rename common/ASC.Core.Common/protos/{QuotaCacheItem.proto => quota_cache_item.proto} (74%) rename common/ASC.Core.Common/protos/{RegisterUserProto.proto => register_user_proto.proto} (55%) rename common/ASC.Core.Common/protos/{SettingsCacheItem.proto => settings_cache_item.proto} (73%) create mode 100644 common/ASC.Core.Common/protos/subscription_method_cache.proto create mode 100644 common/ASC.Core.Common/protos/subscription_record.proto rename common/ASC.Core.Common/protos/{TariffCacheItem.proto => tariff_cache_item.proto} (71%) rename common/ASC.Core.Common/protos/{TenantCacheItem.proto => tenant_cache_item.proto} (71%) rename common/ASC.Core.Common/protos/{TenantSetting.proto => tenant_setting.proto} (73%) create mode 100644 common/ASC.Core.Common/protos/user_group_ref_cache_item.proto rename common/ASC.Core.Common/protos/{UserInfoCacheItem.proto => user_info_cache_item.proto} (61%) rename common/ASC.Core.Common/protos/{UserPhotoCacheItem.proto => user_photo_cache_item.proto} (74%) delete mode 100644 common/ASC.Data.Backup.Core/protos/BackupProgress.proto create mode 100644 common/ASC.Data.Backup.Core/protos/backup_progress.proto rename common/ASC.Data.Backup.Core/protos/{DeleteSchedule.proto => delete_schedule.proto} (77%) delete mode 100644 common/ASC.Data.Storage/protos/MigrationProgress.proto delete mode 100644 common/ASC.Data.Storage/protos/MigrationUploadCdn.proto rename common/ASC.Data.Storage/protos/{DataStoreCacheItem.proto => data_store_cache_item.proto} (57%) rename common/ASC.Data.Storage/protos/{EncryptionStop.proto => encryption_stop.proto} (100%) rename common/ASC.Data.Storage/protos/{MigrationCache.proto => migration_cache.proto} (53%) create mode 100644 common/ASC.Data.Storage/protos/migration_progress.proto create mode 100644 common/ASC.Data.Storage/protos/migration_upload_cdn.proto rename common/ASC.Data.Storage/protos/{ProgressEncryption.proto => progress_encryption.proto} (64%) rename common/ASC.FederatedLogin/protos/{LinkerCacheItem.proto => linker_cache_item.proto} (75%) rename common/ASC.IPSecurity/protos/{IPRestrictionItem.proto => ip_restriction_item.proto} (72%) rename common/ASC.VoipService/protos/{CachedVoipItem.proto => cached_voip_item.proto} (74%) rename common/ASC.Webhooks.Core/proto/{WebhookRequest.proto => webhook_request.proto} (80%) delete mode 100644 common/services/ASC.ElasticSearch/protos/SearchItem.proto create mode 100644 common/services/ASC.ElasticSearch/protos/search_item.proto rename products/ASC.CRM/Server/proto/{ContactPhotoManagerCacheItem.proto => contact_photo_manager_cache_item.proto} (100%) delete mode 100644 products/ASC.Files/Core/proto/BoxCacheItem.proto delete mode 100644 products/ASC.Files/Core/proto/DropboxCacheItem.proto delete mode 100644 products/ASC.Files/Core/proto/GoogleDriveCacheItem.proto delete mode 100644 products/ASC.Files/Core/proto/ThumbnailRequest.proto create mode 100644 products/ASC.Files/Core/proto/box_cache_item.proto create mode 100644 products/ASC.Files/Core/proto/dropbox_cache_item.proto create mode 100644 products/ASC.Files/Core/proto/google_drive_cache_item.proto rename products/ASC.Files/Core/proto/{OneDriveCacheItem.proto => one_drive_cache_item.proto} (66%) rename products/ASC.Files/Core/proto/{ProviderAccountCacheItem.proto => provider_account_cache_item.proto} (81%) rename products/ASC.Files/Core/proto/{SharePointProviderCacheItem.proto => share_point_provider_cache_item.proto} (66%) create mode 100644 products/ASC.Files/Core/proto/thumbnail_request.proto delete mode 100644 web/ASC.Web.Core/protos/UserPhotoManagerCacheItem.proto rename web/ASC.Web.Core/protos/{MailServiceHelperCache.proto => mail_service_helper_cache.proto} (77%) rename web/ASC.Web.Core/protos/{SmsKeyCacheKey.proto => sms_key_cache_key.proto} (75%) rename web/ASC.Web.Core/protos/{TenantLogoCacheItem.proto => tenant_logo_cache_item.proto} (78%) create mode 100644 web/ASC.Web.Core/protos/user_photo_manager_cache_item.proto rename web/ASC.Web.Core/protos/{WebItemSecurityNotifier.proto => web_item_security_notifier.proto} (73%) diff --git a/common/ASC.Common/ASC.Common.csproj b/common/ASC.Common/ASC.Common.csproj index b01185bd36..6038ef792c 100644 --- a/common/ASC.Common/ASC.Common.csproj +++ b/common/ASC.Common/ASC.Common.csproj @@ -59,10 +59,10 @@ - - - - + + + + diff --git a/common/ASC.Common/protos/DistributedTaskCache.proto b/common/ASC.Common/protos/DistributedTaskCache.proto deleted file mode 100644 index 7f2bbb68c0..0000000000 --- a/common/ASC.Common/protos/DistributedTaskCache.proto +++ /dev/null @@ -1,21 +0,0 @@ -syntax = "proto3"; - -package ASC.Common.Threading; - -message DistributedTaskCache { - string Id = 1; - int32 InstanceId = 2; - string Status = 3; - string Exception = 4; - repeated DistributedTaskCacheProp Props = 5; - string Key = 6; - double Percentage = 7; - bool IsCompleted = 8; - int32 StepCount = 9; - - message DistributedTaskCacheProp - { - string Key = 1; - string Value = 2; - } -} \ No newline at end of file diff --git a/common/ASC.Common/protos/NotifyItem.proto b/common/ASC.Common/protos/NotifyItem.proto deleted file mode 100644 index 4919bb1fe9..0000000000 --- a/common/ASC.Common/protos/NotifyItem.proto +++ /dev/null @@ -1,32 +0,0 @@ -syntax = "proto3"; -import "google/protobuf/wrappers.proto"; -package ASC.Notify.Model; - -message NotifyItem { - NotifyActionItem Action = 1; - string ObjectID = 2; - repeated Recipient Recipients = 3; - repeated string SenderNames = 4; - repeated Tag Tags = 5; - bool CheckSubsciption = 6; - int32 TenantId = 7; - string UserId = 8; - string BaseUrl = 9; -} - -message NotifyActionItem { - string ID = 1; -} - -message Recipient { - string ID = 1; - google.protobuf.StringValue Name = 2; - bool CheckActivation = 3; - repeated string Addresses = 4; - bool IsGroup = 5; -} - -message Tag { - string Tag = 1; - string Value = 2; -} \ No newline at end of file diff --git a/common/ASC.Common/protos/AscCacheItem.proto b/common/ASC.Common/protos/asc_cache_item.proto similarity index 73% rename from common/ASC.Common/protos/AscCacheItem.proto rename to common/ASC.Common/protos/asc_cache_item.proto index 74b59401b2..64af604f94 100644 --- a/common/ASC.Common/protos/AscCacheItem.proto +++ b/common/ASC.Common/protos/asc_cache_item.proto @@ -1,7 +1,7 @@ -syntax = "proto3"; - -package ASC.Common; - -message AscCacheItem { - string Id = 1; +syntax = "proto3"; + +package ASC.Common; + +message AscCacheItem { + string id = 1; } \ No newline at end of file diff --git a/common/ASC.Common/protos/distributed_task_cache.proto b/common/ASC.Common/protos/distributed_task_cache.proto new file mode 100644 index 0000000000..780710e04f --- /dev/null +++ b/common/ASC.Common/protos/distributed_task_cache.proto @@ -0,0 +1,21 @@ +syntax = "proto3"; + +package ASC.Common.Threading; + +message DistributedTaskCache { + string id = 1; + int32 instance_id = 2; + string status = 3; + string exception = 4; + repeated DistributedTaskCacheProp props = 5; + string key = 6; + double percentage = 7; + bool is_completed = 8; + int32 step_count = 9; + + message DistributedTaskCacheProp + { + string key = 1; + string value = 2; + } +} \ No newline at end of file diff --git a/common/ASC.Common/protos/DistributedTaskCancelation.proto b/common/ASC.Common/protos/distributed_task_cancelation.proto similarity index 78% rename from common/ASC.Common/protos/DistributedTaskCancelation.proto rename to common/ASC.Common/protos/distributed_task_cancelation.proto index 83fbe22265..e6e96ef8ce 100644 --- a/common/ASC.Common/protos/DistributedTaskCancelation.proto +++ b/common/ASC.Common/protos/distributed_task_cancelation.proto @@ -1,7 +1,7 @@ -syntax = "proto3"; - -package ASC.Common.Threading; - -message DistributedTaskCancelation { - string Id = 1; +syntax = "proto3"; + +package ASC.Common.Threading; + +message DistributedTaskCancelation { + string id = 1; } \ No newline at end of file diff --git a/common/ASC.Common/protos/notify_item.proto b/common/ASC.Common/protos/notify_item.proto new file mode 100644 index 0000000000..d0db117272 --- /dev/null +++ b/common/ASC.Common/protos/notify_item.proto @@ -0,0 +1,32 @@ +syntax = "proto3"; +import "google/protobuf/wrappers.proto"; +package ASC.Notify.Model; + +message NotifyItem { + NotifyActionItem action = 1; + string object_id = 2; + repeated Recipient recipients = 3; + repeated string sender_names = 4; + repeated Tag tags = 5; + bool check_subsciption = 6; + int32 tenant_id = 7; + string user_id = 8; + string base_url = 9; +} + +message NotifyActionItem { + string id = 1; +} + +message Recipient { + string id = 1; + google.protobuf.StringValue name = 2; + bool check_activation = 3; + repeated string addresses = 4; + bool is_group = 5; +} + +message Tag { + string tag = 1; + string value = 2; +} \ No newline at end of file diff --git a/common/ASC.Core.Common/ASC.Core.Common.csproj b/common/ASC.Core.Common/ASC.Core.Common.csproj index 1a00e0b319..f6a18017c4 100644 --- a/common/ASC.Core.Common/ASC.Core.Common.csproj +++ b/common/ASC.Core.Common/ASC.Core.Common.csproj @@ -29,24 +29,24 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + @@ -61,25 +61,25 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/common/ASC.Core.Common/Caching/CachedUserService.cs b/common/ASC.Core.Common/Caching/CachedUserService.cs index 78bf07aedd..a9f67fc10e 100644 --- a/common/ASC.Core.Common/Caching/CachedUserService.cs +++ b/common/ASC.Core.Common/Caching/CachedUserService.cs @@ -85,7 +85,7 @@ namespace ASC.Core.Caching { if (userInfo != null) { - var key = GetUserCacheKey(userInfo.Tenant, new Guid(userInfo.ID)); + var key = GetUserCacheKey(userInfo.Tenant, new Guid(userInfo.Id)); Cache.Remove(key); } } @@ -271,14 +271,14 @@ namespace ASC.Core.Caching public UserInfo SaveUser(int tenant, UserInfo user) { user = Service.SaveUser(tenant, user); - CacheUserInfoItem.Publish(new UserInfoCacheItem { ID = user.ID.ToString(), Tenant = tenant }, CacheNotifyAction.Any); + CacheUserInfoItem.Publish(new UserInfoCacheItem { Id = user.ID.ToString(), Tenant = tenant }, CacheNotifyAction.Any); return user; } public void RemoveUser(int tenant, Guid id) { Service.RemoveUser(tenant, id); - CacheUserInfoItem.Publish(new UserInfoCacheItem { Tenant = tenant, ID = id.ToString() }, CacheNotifyAction.Any); + CacheUserInfoItem.Publish(new UserInfoCacheItem { Tenant = tenant, Id = id.ToString() }, CacheNotifyAction.Any); } public byte[] GetUserPhoto(int tenant, Guid id) @@ -326,14 +326,14 @@ namespace ASC.Core.Caching public Group SaveGroup(int tenant, Group group) { group = Service.SaveGroup(tenant, group); - CacheGroupCacheItem.Publish(new GroupCacheItem { ID = group.Id.ToString() }, CacheNotifyAction.Any); + CacheGroupCacheItem.Publish(new GroupCacheItem { Id = group.Id.ToString() }, CacheNotifyAction.Any); return group; } public void RemoveGroup(int tenant, Guid id) { Service.RemoveGroup(tenant, id); - CacheGroupCacheItem.Publish(new GroupCacheItem { ID = id.ToString() }, CacheNotifyAction.Any); + CacheGroupCacheItem.Publish(new GroupCacheItem { Id = id.ToString() }, CacheNotifyAction.Any); } diff --git a/common/ASC.Core.Common/Notify/Model/NotifyAction.cs b/common/ASC.Core.Common/Notify/Model/NotifyAction.cs index 58318c2f44..e2900b2758 100644 --- a/common/ASC.Core.Common/Notify/Model/NotifyAction.cs +++ b/common/ASC.Core.Common/Notify/Model/NotifyAction.cs @@ -49,12 +49,12 @@ namespace ASC.Notify.Model public static implicit operator NotifyActionItem(NotifyAction cache) { - return new NotifyActionItem() { ID = cache.ID }; + return new NotifyActionItem() { Id = cache.ID }; } public static explicit operator NotifyAction(NotifyActionItem cache) { - return new NotifyAction(cache.ID); + return new NotifyAction(cache.Id); } public override bool Equals(object obj) diff --git a/common/ASC.Core.Common/protos/AzRecordCache.proto b/common/ASC.Core.Common/protos/AzRecordCache.proto deleted file mode 100644 index 1775498b5c..0000000000 --- a/common/ASC.Core.Common/protos/AzRecordCache.proto +++ /dev/null @@ -1,15 +0,0 @@ -syntax = "proto3"; -import "google/protobuf/wrappers.proto"; -package ASC.Core; - -message AzRecordCache { - google.protobuf.StringValue SubjectId = 1; - - google.protobuf.StringValue ActionId = 2; - - google.protobuf.StringValue ObjectId = 3; - - google.protobuf.StringValue Reaction = 4; - - int32 Tenant = 5; -} \ No newline at end of file diff --git a/common/ASC.Core.Common/protos/CreateClientProto.proto b/common/ASC.Core.Common/protos/CreateClientProto.proto deleted file mode 100644 index c0bfd0ea01..0000000000 --- a/common/ASC.Core.Common/protos/CreateClientProto.proto +++ /dev/null @@ -1,11 +0,0 @@ -syntax = "proto3"; - -package ASC.Core.Common.Notify; - -message CreateClientProto { - int32 TenantId = 1; - string Token = 2; - int32 TokenLifespan = 3; - string Proxy = 4; - string Time = 5; -} \ No newline at end of file diff --git a/common/ASC.Core.Common/protos/EncryptionSettingsProto.proto b/common/ASC.Core.Common/protos/EncryptionSettingsProto.proto deleted file mode 100644 index 12e71258f0..0000000000 --- a/common/ASC.Core.Common/protos/EncryptionSettingsProto.proto +++ /dev/null @@ -1,17 +0,0 @@ -syntax = "proto3"; - -package ASC.Core.Encryption; - -message EncryptionSettingsProto { - string password = 1; - EncryprtionStatus Status = 2; - bool NotifyUsers = 3; - string ServerRootPath = 4; -} - -enum EncryprtionStatus { - Decrypted = 0; - EncryptionStarted = 1; - Encrypted = 2; - DecryptionStarted = 3; -} \ No newline at end of file diff --git a/common/ASC.Core.Common/protos/NotifyInvoke.proto b/common/ASC.Core.Common/protos/NotifyInvoke.proto deleted file mode 100644 index 0f9aba7ff2..0000000000 --- a/common/ASC.Core.Common/protos/NotifyInvoke.proto +++ /dev/null @@ -1,10 +0,0 @@ -syntax = "proto3"; - -package ASC.Notify.Messages; - -message NotifyInvoke { - string Service = 1; - string Method = 2; - int32 Tenant = 3; - repeated string Parameters = 4; -} \ No newline at end of file diff --git a/common/ASC.Core.Common/protos/NotifyMessage.proto b/common/ASC.Core.Common/protos/NotifyMessage.proto deleted file mode 100644 index 14e3a637a9..0000000000 --- a/common/ASC.Core.Common/protos/NotifyMessage.proto +++ /dev/null @@ -1,23 +0,0 @@ -syntax = "proto3"; - -package ASC.Notify.Messages; - -message NotifyMessage { - int32 Tenant = 1; - string Sender = 2; - string From = 3; - string To = 4; - string ReplyTo = 5; - string Subject = 6; - string ContentType = 7; - string Content = 8; - int64 CreationDate = 9; - int32 Priority = 10; - repeated NotifyMessageAttachment EmbeddedAttachments = 11; - string AutoSubmitted = 12; -} -message NotifyMessageAttachment { - string FileName = 1; - string ContentId = 2; - bytes Content = 3; -} \ No newline at end of file diff --git a/common/ASC.Core.Common/protos/SubscriptionMethodCache.proto b/common/ASC.Core.Common/protos/SubscriptionMethodCache.proto deleted file mode 100644 index 9fb80effc0..0000000000 --- a/common/ASC.Core.Common/protos/SubscriptionMethodCache.proto +++ /dev/null @@ -1,15 +0,0 @@ -syntax = "proto3"; - -package ASC.Core; - -message SubscriptionMethodCache { - string RecipientId = 1; - - string ActionId = 2; - - string SourceId = 3; - - repeated string Methods = 4; - - int32 Tenant = 5; -} \ No newline at end of file diff --git a/common/ASC.Core.Common/protos/SubscriptionRecord.proto b/common/ASC.Core.Common/protos/SubscriptionRecord.proto deleted file mode 100644 index d2a0208740..0000000000 --- a/common/ASC.Core.Common/protos/SubscriptionRecord.proto +++ /dev/null @@ -1,17 +0,0 @@ -syntax = "proto3"; - -package ASC.Core; - -message SubscriptionRecord { - string RecipientId = 1; - - string ActionId = 2; - - string ObjectId = 3; - - string SourceId = 4; - - bool Subscribed = 5; - - int32 Tenant = 6; -} \ No newline at end of file diff --git a/common/ASC.Core.Common/protos/UserGroupRefCacheItem.proto b/common/ASC.Core.Common/protos/UserGroupRefCacheItem.proto deleted file mode 100644 index 0c894c1601..0000000000 --- a/common/ASC.Core.Common/protos/UserGroupRefCacheItem.proto +++ /dev/null @@ -1,12 +0,0 @@ -syntax = "proto3"; - -package ASC.Core.Caching; - -message UserGroupRefCacheItem { - string UserId = 1; - string GroupId = 2; - bool Removed = 3; - string RefType = 4; - int64 LastModified = 5; - int32 Tenant = 6; -} diff --git a/common/ASC.Core.Common/protos/az_record_cache.proto b/common/ASC.Core.Common/protos/az_record_cache.proto new file mode 100644 index 0000000000..81cc843d28 --- /dev/null +++ b/common/ASC.Core.Common/protos/az_record_cache.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; +import "google/protobuf/wrappers.proto"; +package ASC.Core; + +message AzRecordCache { + google.protobuf.StringValue subject_id = 1; + + google.protobuf.StringValue action_id = 2; + + google.protobuf.StringValue object_id = 3; + + google.protobuf.StringValue reaction = 4; + + int32 tenant = 5; +} \ No newline at end of file diff --git a/common/ASC.Core.Common/protos/ConsumerCacheItem.proto b/common/ASC.Core.Common/protos/consumer_cache_item.proto similarity index 63% rename from common/ASC.Core.Common/protos/ConsumerCacheItem.proto rename to common/ASC.Core.Common/protos/consumer_cache_item.proto index 7c4ee11ca1..629e46c1fd 100644 --- a/common/ASC.Core.Common/protos/ConsumerCacheItem.proto +++ b/common/ASC.Core.Common/protos/consumer_cache_item.proto @@ -1,8 +1,8 @@ -syntax = "proto3"; - -package ASC.Core.Common.Configuration; - -message ConsumerCacheItem { - string Name = 1; - int32 TenantId = 2; +syntax = "proto3"; + +package ASC.Core.Common.Configuration; + +message ConsumerCacheItem { + string name = 1; + int32 tenant_id = 2; } \ No newline at end of file diff --git a/common/ASC.Core.Common/protos/create_client_proto.proto b/common/ASC.Core.Common/protos/create_client_proto.proto new file mode 100644 index 0000000000..26d02d59d8 --- /dev/null +++ b/common/ASC.Core.Common/protos/create_client_proto.proto @@ -0,0 +1,11 @@ +syntax = "proto3"; + +package ASC.Core.Common.Notify; + +message CreateClientProto { + int32 tenant_id = 1; + string token = 2; + int32 token_lifespan = 3; + string proxy = 4; + string time = 5; +} \ No newline at end of file diff --git a/common/ASC.Core.Common/protos/DisableClientProto.proto b/common/ASC.Core.Common/protos/disable_client_proto.proto similarity index 78% rename from common/ASC.Core.Common/protos/DisableClientProto.proto rename to common/ASC.Core.Common/protos/disable_client_proto.proto index 1eff1e9df9..8d0a30e5ed 100644 --- a/common/ASC.Core.Common/protos/DisableClientProto.proto +++ b/common/ASC.Core.Common/protos/disable_client_proto.proto @@ -3,5 +3,5 @@ package ASC.Core.Common.Notify; message DisableClientProto { - int32 TenantId= 1; + int32 tenant_id= 1; } \ No newline at end of file diff --git a/common/ASC.Core.Common/protos/encryption_settings_proto.proto b/common/ASC.Core.Common/protos/encryption_settings_proto.proto new file mode 100644 index 0000000000..2b95954f1b --- /dev/null +++ b/common/ASC.Core.Common/protos/encryption_settings_proto.proto @@ -0,0 +1,17 @@ +syntax = "proto3"; + +package ASC.Core.Encryption; + +message EncryptionSettingsProto { + string password = 1; + EncryprtionStatus status = 2; + bool notify_users = 3; + string server_root_path = 4; +} + +enum EncryprtionStatus { + DECRYPTED = 0; + ENCRYPTION_STARTED = 1; + ENCRYPTED = 2; + DECRYPTION_STARTED = 3; +} \ No newline at end of file diff --git a/common/ASC.Core.Common/protos/GroupCacheItem.proto b/common/ASC.Core.Common/protos/group_cache_item.proto similarity index 74% rename from common/ASC.Core.Common/protos/GroupCacheItem.proto rename to common/ASC.Core.Common/protos/group_cache_item.proto index bc17b85572..e8d3fa5e89 100644 --- a/common/ASC.Core.Common/protos/GroupCacheItem.proto +++ b/common/ASC.Core.Common/protos/group_cache_item.proto @@ -1,7 +1,7 @@ -syntax = "proto3"; - -package ASC.Core.Caching; - -message GroupCacheItem { - string ID = 1; +syntax = "proto3"; + +package ASC.Core.Caching; + +message GroupCacheItem { + string id = 1; } \ No newline at end of file diff --git a/common/ASC.Core.Common/protos/notify_invoke.proto b/common/ASC.Core.Common/protos/notify_invoke.proto new file mode 100644 index 0000000000..166cf5668b --- /dev/null +++ b/common/ASC.Core.Common/protos/notify_invoke.proto @@ -0,0 +1,10 @@ +syntax = "proto3"; + +package ASC.Notify.Messages; + +message NotifyInvoke { + string service = 1; + string method = 2; + int32 tenant = 3; + repeated string parameters = 4; +} \ No newline at end of file diff --git a/common/ASC.Core.Common/protos/notify_message.proto b/common/ASC.Core.Common/protos/notify_message.proto new file mode 100644 index 0000000000..c70bfd8a5c --- /dev/null +++ b/common/ASC.Core.Common/protos/notify_message.proto @@ -0,0 +1,23 @@ +syntax = "proto3"; + +package ASC.Notify.Messages; + +message NotifyMessage { + int32 tenant = 1; + string sender = 2; + string from = 3; + string to = 4; + string reply_to = 5; + string subject = 6; + string content_type = 7; + string content = 8; + int64 creation_date = 9; + int32 priority = 10; + repeated NotifyMessageAttachment embedded_attachments = 11; + string auto_submitted = 12; +} +message NotifyMessageAttachment { + string FileName = 1; + string ContentId = 2; + bytes Content = 3; +} \ No newline at end of file diff --git a/common/ASC.Core.Common/protos/QuotaCacheItem.proto b/common/ASC.Core.Common/protos/quota_cache_item.proto similarity index 74% rename from common/ASC.Core.Common/protos/QuotaCacheItem.proto rename to common/ASC.Core.Common/protos/quota_cache_item.proto index 4e3424dd0a..ef66f8c5e5 100644 --- a/common/ASC.Core.Common/protos/QuotaCacheItem.proto +++ b/common/ASC.Core.Common/protos/quota_cache_item.proto @@ -1,7 +1,7 @@ -syntax = "proto3"; - -package ASC.Core.Caching; - -message QuotaCacheItem { - string Key = 1; +syntax = "proto3"; + +package ASC.Core.Caching; + +message QuotaCacheItem { + string key = 1; } \ No newline at end of file diff --git a/common/ASC.Core.Common/protos/RegisterUserProto.proto b/common/ASC.Core.Common/protos/register_user_proto.proto similarity index 55% rename from common/ASC.Core.Common/protos/RegisterUserProto.proto rename to common/ASC.Core.Common/protos/register_user_proto.proto index 1a91b33fb6..9bd6a44895 100644 --- a/common/ASC.Core.Common/protos/RegisterUserProto.proto +++ b/common/ASC.Core.Common/protos/register_user_proto.proto @@ -3,7 +3,7 @@ package ASC.Core.Common.Notify; message RegisterUserProto { - string UserId= 1; - int32 TenantId= 2; - string Token= 3; + string user_id= 1; + int32 tenant_id= 2; + string token= 3; } diff --git a/common/ASC.Core.Common/protos/SettingsCacheItem.proto b/common/ASC.Core.Common/protos/settings_cache_item.proto similarity index 73% rename from common/ASC.Core.Common/protos/SettingsCacheItem.proto rename to common/ASC.Core.Common/protos/settings_cache_item.proto index 5ea510fd59..b8bd4a1cac 100644 --- a/common/ASC.Core.Common/protos/SettingsCacheItem.proto +++ b/common/ASC.Core.Common/protos/settings_cache_item.proto @@ -1,7 +1,7 @@ -syntax = "proto3"; - -package ASC.Core.Data; - -message SettingsCacheItem { - string Key = 1; +syntax = "proto3"; + +package ASC.Core.Data; + +message SettingsCacheItem { + string key = 1; } \ No newline at end of file diff --git a/common/ASC.Core.Common/protos/subscription_method_cache.proto b/common/ASC.Core.Common/protos/subscription_method_cache.proto new file mode 100644 index 0000000000..8fc05e7bcc --- /dev/null +++ b/common/ASC.Core.Common/protos/subscription_method_cache.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; + +package ASC.Core; + +message SubscriptionMethodCache { + string recipient_id = 1; + + string action_id = 2; + + string source_id = 3; + + repeated string methods = 4; + + int32 tenant = 5; +} \ No newline at end of file diff --git a/common/ASC.Core.Common/protos/subscription_record.proto b/common/ASC.Core.Common/protos/subscription_record.proto new file mode 100644 index 0000000000..f21bc14034 --- /dev/null +++ b/common/ASC.Core.Common/protos/subscription_record.proto @@ -0,0 +1,17 @@ +syntax = "proto3"; + +package ASC.Core; + +message SubscriptionRecord { + string recipient_id = 1; + + string action_id = 2; + + string object_id = 3; + + string source_id = 4; + + bool subscribed = 5; + + int32 tenant = 6; +} \ No newline at end of file diff --git a/common/ASC.Core.Common/protos/TariffCacheItem.proto b/common/ASC.Core.Common/protos/tariff_cache_item.proto similarity index 71% rename from common/ASC.Core.Common/protos/TariffCacheItem.proto rename to common/ASC.Core.Common/protos/tariff_cache_item.proto index f4dd7c0751..14f68940da 100644 --- a/common/ASC.Core.Common/protos/TariffCacheItem.proto +++ b/common/ASC.Core.Common/protos/tariff_cache_item.proto @@ -1,7 +1,7 @@ -syntax = "proto3"; - -package ASC.Core.Billing; - -message TariffCacheItem { - int32 TenantId = 1; +syntax = "proto3"; + +package ASC.Core.Billing; + +message TariffCacheItem { + int32 tenant_id = 1; } \ No newline at end of file diff --git a/common/ASC.Core.Common/protos/TenantCacheItem.proto b/common/ASC.Core.Common/protos/tenant_cache_item.proto similarity index 71% rename from common/ASC.Core.Common/protos/TenantCacheItem.proto rename to common/ASC.Core.Common/protos/tenant_cache_item.proto index c727da0889..6e43399a38 100644 --- a/common/ASC.Core.Common/protos/TenantCacheItem.proto +++ b/common/ASC.Core.Common/protos/tenant_cache_item.proto @@ -1,7 +1,7 @@ -syntax = "proto3"; - -package ASC.Core.Caching; - -message TenantCacheItem { - int32 TenantId = 1; +syntax = "proto3"; + +package ASC.Core.Caching; + +message TenantCacheItem { + int32 tenant_id = 1; } \ No newline at end of file diff --git a/common/ASC.Core.Common/protos/TenantSetting.proto b/common/ASC.Core.Common/protos/tenant_setting.proto similarity index 73% rename from common/ASC.Core.Common/protos/TenantSetting.proto rename to common/ASC.Core.Common/protos/tenant_setting.proto index d150289d62..a9e0a9c099 100644 --- a/common/ASC.Core.Common/protos/TenantSetting.proto +++ b/common/ASC.Core.Common/protos/tenant_setting.proto @@ -1,7 +1,7 @@ -syntax = "proto3"; - -package ASC.Core.Caching; - -message TenantSetting { - string Key = 1; +syntax = "proto3"; + +package ASC.Core.Caching; + +message TenantSetting { + string key = 1; } \ No newline at end of file diff --git a/common/ASC.Core.Common/protos/user_group_ref_cache_item.proto b/common/ASC.Core.Common/protos/user_group_ref_cache_item.proto new file mode 100644 index 0000000000..43a1e327ce --- /dev/null +++ b/common/ASC.Core.Common/protos/user_group_ref_cache_item.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; + +package ASC.Core.Caching; + +message UserGroupRefCacheItem { + string user_id = 1; + string group_id = 2; + bool removed = 3; + string ref_type = 4; + int64 last_modified = 5; + int32 tenant = 6; +} diff --git a/common/ASC.Core.Common/protos/UserInfoCacheItem.proto b/common/ASC.Core.Common/protos/user_info_cache_item.proto similarity index 61% rename from common/ASC.Core.Common/protos/UserInfoCacheItem.proto rename to common/ASC.Core.Common/protos/user_info_cache_item.proto index 14ac3fc2ed..3ba117ba43 100644 --- a/common/ASC.Core.Common/protos/UserInfoCacheItem.proto +++ b/common/ASC.Core.Common/protos/user_info_cache_item.proto @@ -1,8 +1,8 @@ -syntax = "proto3"; - -package ASC.Core.Caching; - -message UserInfoCacheItem { - string ID = 1; - int32 Tenant = 2; +syntax = "proto3"; + +package ASC.Core.Caching; + +message UserInfoCacheItem { + string id = 1; + int32 tenant = 2; } \ No newline at end of file diff --git a/common/ASC.Core.Common/protos/UserPhotoCacheItem.proto b/common/ASC.Core.Common/protos/user_photo_cache_item.proto similarity index 74% rename from common/ASC.Core.Common/protos/UserPhotoCacheItem.proto rename to common/ASC.Core.Common/protos/user_photo_cache_item.proto index 0360fe83ed..222eb422af 100644 --- a/common/ASC.Core.Common/protos/UserPhotoCacheItem.proto +++ b/common/ASC.Core.Common/protos/user_photo_cache_item.proto @@ -1,7 +1,7 @@ -syntax = "proto3"; - -package ASC.Core.Caching; - -message UserPhotoCacheItem { - string Key = 1; +syntax = "proto3"; + +package ASC.Core.Caching; + +message UserPhotoCacheItem { + string key = 1; } \ No newline at end of file diff --git a/common/ASC.Data.Backup.Core/ASC.Data.Backup.Core.csproj b/common/ASC.Data.Backup.Core/ASC.Data.Backup.Core.csproj index c58fa94e73..d497d21597 100644 --- a/common/ASC.Data.Backup.Core/ASC.Data.Backup.Core.csproj +++ b/common/ASC.Data.Backup.Core/ASC.Data.Backup.Core.csproj @@ -8,8 +8,8 @@ - - + + @@ -29,8 +29,8 @@ - - + + diff --git a/common/ASC.Data.Backup.Core/protos/BackupProgress.proto b/common/ASC.Data.Backup.Core/protos/BackupProgress.proto deleted file mode 100644 index 0b3740f43a..0000000000 --- a/common/ASC.Data.Backup.Core/protos/BackupProgress.proto +++ /dev/null @@ -1,18 +0,0 @@ -syntax = "proto3"; - -package ASC.Data.Backup.Contracts; - -message BackupProgress { - bool IsCompleted = 1; - int32 Progress = 2; - string Error = 3; - string Link = 4; - int32 TenantId = 5; - BackupProgressEnum BackupProgressEnum = 6; -} - -enum BackupProgressEnum { - Backup = 0; - Restore = 1; - Transfer = 2; -} \ No newline at end of file diff --git a/common/ASC.Data.Backup.Core/protos/backup_progress.proto b/common/ASC.Data.Backup.Core/protos/backup_progress.proto new file mode 100644 index 0000000000..142eb6a2b1 --- /dev/null +++ b/common/ASC.Data.Backup.Core/protos/backup_progress.proto @@ -0,0 +1,18 @@ +syntax = "proto3"; + +package ASC.Data.Backup.Contracts; + +message BackupProgress { + bool is_completed = 1; + int32 progress = 2; + string error = 3; + string link = 4; + int32 tenant_id = 5; + BackupProgressEnum backup_progress_enum = 6; +} + +enum BackupProgressEnum { + BACKUP = 0; + RESTORE = 1; + TRANSFER = 2; +} \ No newline at end of file diff --git a/common/ASC.Data.Backup.Core/protos/DeleteSchedule.proto b/common/ASC.Data.Backup.Core/protos/delete_schedule.proto similarity index 77% rename from common/ASC.Data.Backup.Core/protos/DeleteSchedule.proto rename to common/ASC.Data.Backup.Core/protos/delete_schedule.proto index 89a20a8c0a..82dd12d7c0 100644 --- a/common/ASC.Data.Backup.Core/protos/DeleteSchedule.proto +++ b/common/ASC.Data.Backup.Core/protos/delete_schedule.proto @@ -3,5 +3,5 @@ package ASC.Data.Backup.Contracts; message DeleteSchedule { - int32 TenantId = 1; + int32 tenant_id = 1; } diff --git a/common/ASC.Data.Storage/ASC.Data.Storage.csproj b/common/ASC.Data.Storage/ASC.Data.Storage.csproj index 3cdd7eb2cd..80827e1fca 100644 --- a/common/ASC.Data.Storage/ASC.Data.Storage.csproj +++ b/common/ASC.Data.Storage/ASC.Data.Storage.csproj @@ -22,11 +22,11 @@ - - - - - + + + + + @@ -50,12 +50,12 @@ - - - - - - + + + + + + diff --git a/common/ASC.Data.Storage/Migration/MigrateServiceClient.cs b/common/ASC.Data.Storage/Migration/MigrateServiceClient.cs index 43deceb061..4ee2df0216 100644 --- a/common/ASC.Data.Storage/Migration/MigrateServiceClient.cs +++ b/common/ASC.Data.Storage/Migration/MigrateServiceClient.cs @@ -102,7 +102,7 @@ namespace ASC.Data.Storage.Migration public void Migrate(int tenant, StorageSettings storageSettings) { - var storSettings = new StorSettings { ID = storageSettings.ID.ToString(), Module = storageSettings.Module }; + var storSettings = new StorSettings { Id = storageSettings.ID.ToString(), Module = storageSettings.Module }; CacheMigrationNotify.Publish(new MigrationCache { @@ -114,7 +114,7 @@ namespace ASC.Data.Storage.Migration public void UploadCdn(int tenantId, string relativePath, string mappedPath, CdnStorageSettings settings = null) { - var cdnStorSettings = new CdnStorSettings { ID = settings.ID.ToString(), Module = settings.Module }; + var cdnStorSettings = new CdnStorSettings { Id = settings.ID.ToString(), Module = settings.Module }; UploadCdnMigrationNotify.Publish(new MigrationUploadCdn { diff --git a/common/ASC.Data.Storage/protos/MigrationProgress.proto b/common/ASC.Data.Storage/protos/MigrationProgress.proto deleted file mode 100644 index 0b9ff4224d..0000000000 --- a/common/ASC.Data.Storage/protos/MigrationProgress.proto +++ /dev/null @@ -1,11 +0,0 @@ -syntax = "proto3"; - -package ASC.Protos.Migration; - -message MigrationProgress{ - bool IsCompleted = 1; - double Progress = 2; - string Error = 3; - string Link = 4; - int32 TenantId = 5; -} diff --git a/common/ASC.Data.Storage/protos/MigrationUploadCdn.proto b/common/ASC.Data.Storage/protos/MigrationUploadCdn.proto deleted file mode 100644 index f2f1d6d475..0000000000 --- a/common/ASC.Data.Storage/protos/MigrationUploadCdn.proto +++ /dev/null @@ -1,16 +0,0 @@ -syntax = "proto3"; - -package ASC.Protos.Migration; - -message MigrationUploadCdn { - int32 Tenant = 1; - string RelativePath = 2; - string MappedPath = 3; - CdnStorSettings CdnStorSettings = 4; -} - -message CdnStorSettings { - string ID = 1; - string Module = 2; -} - diff --git a/common/ASC.Data.Storage/protos/DataStoreCacheItem.proto b/common/ASC.Data.Storage/protos/data_store_cache_item.proto similarity index 57% rename from common/ASC.Data.Storage/protos/DataStoreCacheItem.proto rename to common/ASC.Data.Storage/protos/data_store_cache_item.proto index 27007b2ec3..002aacf4ac 100644 --- a/common/ASC.Data.Storage/protos/DataStoreCacheItem.proto +++ b/common/ASC.Data.Storage/protos/data_store_cache_item.proto @@ -1,9 +1,9 @@ -syntax = "proto3"; - -package ASC.Core; - -message DataStoreCacheItem { - string Module = 1; +syntax = "proto3"; - string TenantId = 2; +package ASC.Core; + +message DataStoreCacheItem { + string module = 1; + + string tenant_id = 2; } \ No newline at end of file diff --git a/common/ASC.Data.Storage/protos/EncryptionStop.proto b/common/ASC.Data.Storage/protos/encryption_stop.proto similarity index 100% rename from common/ASC.Data.Storage/protos/EncryptionStop.proto rename to common/ASC.Data.Storage/protos/encryption_stop.proto diff --git a/common/ASC.Data.Storage/protos/MigrationCache.proto b/common/ASC.Data.Storage/protos/migration_cache.proto similarity index 53% rename from common/ASC.Data.Storage/protos/MigrationCache.proto rename to common/ASC.Data.Storage/protos/migration_cache.proto index 3555b4ab1f..dc0955ede4 100644 --- a/common/ASC.Data.Storage/protos/MigrationCache.proto +++ b/common/ASC.Data.Storage/protos/migration_cache.proto @@ -3,12 +3,12 @@ syntax = "proto3"; package ASC.Protos.Migration; message MigrationCache { - int32 TenantId = 1; - StorSettings StorSettings = 2; + int32 tenant_id = 1; + StorSettings stor_settings = 2; } message StorSettings { - string ID = 1; - string Module = 2; + string id = 1; + string module = 2; } diff --git a/common/ASC.Data.Storage/protos/migration_progress.proto b/common/ASC.Data.Storage/protos/migration_progress.proto new file mode 100644 index 0000000000..fe1a7165cf --- /dev/null +++ b/common/ASC.Data.Storage/protos/migration_progress.proto @@ -0,0 +1,11 @@ +syntax = "proto3"; + +package ASC.Protos.Migration; + +message MigrationProgress{ + bool is_completed = 1; + double progress = 2; + string error = 3; + string link = 4; + int32 tenant_id = 5; +} diff --git a/common/ASC.Data.Storage/protos/migration_upload_cdn.proto b/common/ASC.Data.Storage/protos/migration_upload_cdn.proto new file mode 100644 index 0000000000..65a69732d5 --- /dev/null +++ b/common/ASC.Data.Storage/protos/migration_upload_cdn.proto @@ -0,0 +1,16 @@ +syntax = "proto3"; + +package ASC.Protos.Migration; + +message MigrationUploadCdn { + int32 tenant = 1; + string relative_path = 2; + string mapped_path = 3; + CdnStorSettings cdn_stor_settings = 4; +} + +message CdnStorSettings { + string id = 1; + string module = 2; +} + diff --git a/common/ASC.Data.Storage/protos/ProgressEncryption.proto b/common/ASC.Data.Storage/protos/progress_encryption.proto similarity index 64% rename from common/ASC.Data.Storage/protos/ProgressEncryption.proto rename to common/ASC.Data.Storage/protos/progress_encryption.proto index 16dbd3f258..235b2b5ad5 100644 --- a/common/ASC.Data.Storage/protos/ProgressEncryption.proto +++ b/common/ASC.Data.Storage/protos/progress_encryption.proto @@ -3,6 +3,6 @@ package ASC.Data.Storage.Encryption; message ProgressEncryption { - double Progress = 1; - int32 TenantId = 2; + double progress = 1; + int32 tenant_id = 2; } \ No newline at end of file diff --git a/common/ASC.FederatedLogin/ASC.FederatedLogin.csproj b/common/ASC.FederatedLogin/ASC.FederatedLogin.csproj index 28cf4aa407..71605e7ea1 100644 --- a/common/ASC.FederatedLogin/ASC.FederatedLogin.csproj +++ b/common/ASC.FederatedLogin/ASC.FederatedLogin.csproj @@ -37,7 +37,7 @@ - + diff --git a/common/ASC.FederatedLogin/protos/LinkerCacheItem.proto b/common/ASC.FederatedLogin/protos/linker_cache_item.proto similarity index 75% rename from common/ASC.FederatedLogin/protos/LinkerCacheItem.proto rename to common/ASC.FederatedLogin/protos/linker_cache_item.proto index cb9312b445..8b37caa389 100644 --- a/common/ASC.FederatedLogin/protos/LinkerCacheItem.proto +++ b/common/ASC.FederatedLogin/protos/linker_cache_item.proto @@ -1,7 +1,7 @@ -syntax = "proto3"; - -package ASC.FederatedLogin; - -message LinkerCacheItem { - string Obj = 1; +syntax = "proto3"; + +package ASC.FederatedLogin; + +message LinkerCacheItem { + string obj = 1; } \ No newline at end of file diff --git a/common/ASC.IPSecurity/ASC.IPSecurity.csproj b/common/ASC.IPSecurity/ASC.IPSecurity.csproj index 2570bb72b2..9a2e9296e6 100644 --- a/common/ASC.IPSecurity/ASC.IPSecurity.csproj +++ b/common/ASC.IPSecurity/ASC.IPSecurity.csproj @@ -24,6 +24,6 @@ - + diff --git a/common/ASC.IPSecurity/protos/IPRestrictionItem.proto b/common/ASC.IPSecurity/protos/ip_restriction_item.proto similarity index 72% rename from common/ASC.IPSecurity/protos/IPRestrictionItem.proto rename to common/ASC.IPSecurity/protos/ip_restriction_item.proto index bdf27f8af0..63314a47fa 100644 --- a/common/ASC.IPSecurity/protos/IPRestrictionItem.proto +++ b/common/ASC.IPSecurity/protos/ip_restriction_item.proto @@ -1,7 +1,7 @@ -syntax = "proto3"; - -package ASC.IPSecurity; - +syntax = "proto3"; + +package ASC.IPSecurity; + message IPRestrictionItem { - int32 TenantId = 1; + int32 tenant_id = 1; } \ No newline at end of file diff --git a/common/ASC.VoipService/ASC.VoipService.csproj b/common/ASC.VoipService/ASC.VoipService.csproj index 54acd3e489..43a83627c9 100644 --- a/common/ASC.VoipService/ASC.VoipService.csproj +++ b/common/ASC.VoipService/ASC.VoipService.csproj @@ -34,6 +34,6 @@ - + diff --git a/common/ASC.VoipService/protos/CachedVoipItem.proto b/common/ASC.VoipService/protos/cached_voip_item.proto similarity index 74% rename from common/ASC.VoipService/protos/CachedVoipItem.proto rename to common/ASC.VoipService/protos/cached_voip_item.proto index 3dc2088bab..a49b56ca52 100644 --- a/common/ASC.VoipService/protos/CachedVoipItem.proto +++ b/common/ASC.VoipService/protos/cached_voip_item.proto @@ -1,7 +1,7 @@ -syntax = "proto3"; - -package ASC.VoipService.Dao; - +syntax = "proto3"; + +package ASC.VoipService.Dao; + message CachedVoipItem { - int32 Tenant = 1; + int32 tenant = 1; } \ No newline at end of file diff --git a/common/ASC.Webhooks.Core/ASC.Webhooks.Core.csproj b/common/ASC.Webhooks.Core/ASC.Webhooks.Core.csproj index 2797a3ea79..b96022a035 100644 --- a/common/ASC.Webhooks.Core/ASC.Webhooks.Core.csproj +++ b/common/ASC.Webhooks.Core/ASC.Webhooks.Core.csproj @@ -15,7 +15,7 @@ - + @@ -30,7 +30,7 @@ - + diff --git a/common/ASC.Webhooks.Core/proto/WebhookRequest.proto b/common/ASC.Webhooks.Core/proto/webhook_request.proto similarity index 80% rename from common/ASC.Webhooks.Core/proto/WebhookRequest.proto rename to common/ASC.Webhooks.Core/proto/webhook_request.proto index 2fc52bdcf7..cf18fab409 100644 --- a/common/ASC.Webhooks.Core/proto/WebhookRequest.proto +++ b/common/ASC.Webhooks.Core/proto/webhook_request.proto @@ -3,5 +3,5 @@ syntax = "proto3"; package ASC.Web.Webhooks; message WebhookRequest { - int32 Id = 1; + int32 id = 1; }; \ No newline at end of file diff --git a/common/services/ASC.ElasticSearch/ASC.ElasticSearch.csproj b/common/services/ASC.ElasticSearch/ASC.ElasticSearch.csproj index 68f165c340..60ab191dcd 100644 --- a/common/services/ASC.ElasticSearch/ASC.ElasticSearch.csproj +++ b/common/services/ASC.ElasticSearch/ASC.ElasticSearch.csproj @@ -24,7 +24,7 @@ - + @@ -43,6 +43,6 @@ - + \ No newline at end of file diff --git a/common/services/ASC.ElasticSearch/protos/SearchItem.proto b/common/services/ASC.ElasticSearch/protos/SearchItem.proto deleted file mode 100644 index 486eff724e..0000000000 --- a/common/services/ASC.ElasticSearch/protos/SearchItem.proto +++ /dev/null @@ -1,17 +0,0 @@ -syntax = "proto3"; - -package ASC.ElasticSearch; - -message ClearIndexAction { - string Id = 1; -} - -message ReIndexAction { - int32 Tenant = 1; - repeated string Names = 2; -} - -message IndexAction { - string Indexing = 1; - int64 LastIndexed = 2; -} \ No newline at end of file diff --git a/common/services/ASC.ElasticSearch/protos/search_item.proto b/common/services/ASC.ElasticSearch/protos/search_item.proto new file mode 100644 index 0000000000..2699b7b8de --- /dev/null +++ b/common/services/ASC.ElasticSearch/protos/search_item.proto @@ -0,0 +1,17 @@ +syntax = "proto3"; + +package ASC.ElasticSearch; + +message ClearIndexAction { + string id = 1; +} + +message ReIndexAction { + int32 tenant = 1; + repeated string names = 2; +} + +message IndexAction { + string indexing = 1; + int64 last_indexed = 2; +} \ No newline at end of file diff --git a/config/storage.json b/config/storage.json index 80540fb279..196ebe43b8 100644 --- a/config/storage.json +++ b/config/storage.json @@ -13,7 +13,7 @@ "property": [ { "name": "$STORAGE_ROOT", - "value": "..\\Data\\" + "value": "C:\\Works\\Data\\" } ] } diff --git a/products/ASC.CRM/Server/ASC.CRM.csproj b/products/ASC.CRM/Server/ASC.CRM.csproj index 1c101eec62..c4b08219de 100644 --- a/products/ASC.CRM/Server/ASC.CRM.csproj +++ b/products/ASC.CRM/Server/ASC.CRM.csproj @@ -181,7 +181,7 @@ - + diff --git a/products/ASC.CRM/Server/proto/ContactPhotoManagerCacheItem.proto b/products/ASC.CRM/Server/proto/contact_photo_manager_cache_item.proto similarity index 100% rename from products/ASC.CRM/Server/proto/ContactPhotoManagerCacheItem.proto rename to products/ASC.CRM/Server/proto/contact_photo_manager_cache_item.proto diff --git a/products/ASC.Files/Core/ASC.Files.Core.csproj b/products/ASC.Files/Core/ASC.Files.Core.csproj index ade48cd4af..3addf4d1e0 100644 --- a/products/ASC.Files/Core/ASC.Files.Core.csproj +++ b/products/ASC.Files/Core/ASC.Files.Core.csproj @@ -8,13 +8,13 @@ - - - - - - - + + + + + + + @@ -38,13 +38,13 @@ - - - - - - - + + + + + + + diff --git a/products/ASC.Files/Core/proto/BoxCacheItem.proto b/products/ASC.Files/Core/proto/BoxCacheItem.proto deleted file mode 100644 index 03676f5847..0000000000 --- a/products/ASC.Files/Core/proto/BoxCacheItem.proto +++ /dev/null @@ -1,10 +0,0 @@ -syntax = "proto3"; - -package ASC.Files.Thirdparty.Box; - -message BoxCacheItem { - bool ResetAll = 1; - bool IsFile = 2; - bool IsFileExists = 3; - string Key = 4; -} \ No newline at end of file diff --git a/products/ASC.Files/Core/proto/DropboxCacheItem.proto b/products/ASC.Files/Core/proto/DropboxCacheItem.proto deleted file mode 100644 index 3a2ec9eb41..0000000000 --- a/products/ASC.Files/Core/proto/DropboxCacheItem.proto +++ /dev/null @@ -1,10 +0,0 @@ -syntax = "proto3"; - -package ASC.Files.Thirdparty.Dropbox; - -message DropboxCacheItem { - bool ResetAll = 1; - bool IsFile = 2; - bool IsFileExists = 3; - string Key = 4; -} \ No newline at end of file diff --git a/products/ASC.Files/Core/proto/GoogleDriveCacheItem.proto b/products/ASC.Files/Core/proto/GoogleDriveCacheItem.proto deleted file mode 100644 index 206b40ebc1..0000000000 --- a/products/ASC.Files/Core/proto/GoogleDriveCacheItem.proto +++ /dev/null @@ -1,12 +0,0 @@ -syntax = "proto3"; - -package ASC.Files.Thirdparty.GoogleDrive; - -message GoogleDriveCacheItem { - bool ResetAll = 1; - bool ResetEntry = 2; - bool ResetChilds = 3; - string Key = 4; - bool ChildFolder = 5; - bool ChildFolderExist = 6; -} \ No newline at end of file diff --git a/products/ASC.Files/Core/proto/ThumbnailRequest.proto b/products/ASC.Files/Core/proto/ThumbnailRequest.proto deleted file mode 100644 index 8b9f6be34c..0000000000 --- a/products/ASC.Files/Core/proto/ThumbnailRequest.proto +++ /dev/null @@ -1,9 +0,0 @@ -syntax = "proto3"; - -package ASC.Web.Files; - -message ThumbnailRequest { - int32 Tenant = 1; - repeated int32 Files = 2; - string BaseUrl = 3; -} \ No newline at end of file diff --git a/products/ASC.Files/Core/proto/box_cache_item.proto b/products/ASC.Files/Core/proto/box_cache_item.proto new file mode 100644 index 0000000000..77cff3e1bd --- /dev/null +++ b/products/ASC.Files/Core/proto/box_cache_item.proto @@ -0,0 +1,10 @@ +syntax = "proto3"; + +package ASC.Files.Thirdparty.Box; + +message BoxCacheItem { + bool reset_all = 1; + bool is_file = 2; + bool is_file_exists = 3; + string key = 4; +} \ No newline at end of file diff --git a/products/ASC.Files/Core/proto/dropbox_cache_item.proto b/products/ASC.Files/Core/proto/dropbox_cache_item.proto new file mode 100644 index 0000000000..11927bee4f --- /dev/null +++ b/products/ASC.Files/Core/proto/dropbox_cache_item.proto @@ -0,0 +1,10 @@ +syntax = "proto3"; + +package ASC.Files.Thirdparty.Dropbox; + +message DropboxCacheItem { + bool reset_all = 1; + bool is_file = 2; + bool is_file_exists = 3; + string key = 4; +} \ No newline at end of file diff --git a/products/ASC.Files/Core/proto/google_drive_cache_item.proto b/products/ASC.Files/Core/proto/google_drive_cache_item.proto new file mode 100644 index 0000000000..d634dcc49e --- /dev/null +++ b/products/ASC.Files/Core/proto/google_drive_cache_item.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; + +package ASC.Files.Thirdparty.GoogleDrive; + +message GoogleDriveCacheItem { + bool reset_all = 1; + bool reset_entry = 2; + bool reset_childs = 3; + string key = 4; + bool child_folder = 5; + bool child_folder_exist = 6; +} \ No newline at end of file diff --git a/products/ASC.Files/Core/proto/OneDriveCacheItem.proto b/products/ASC.Files/Core/proto/one_drive_cache_item.proto similarity index 66% rename from products/ASC.Files/Core/proto/OneDriveCacheItem.proto rename to products/ASC.Files/Core/proto/one_drive_cache_item.proto index 49de719aa9..90ef8abdaa 100644 --- a/products/ASC.Files/Core/proto/OneDriveCacheItem.proto +++ b/products/ASC.Files/Core/proto/one_drive_cache_item.proto @@ -3,6 +3,6 @@ syntax = "proto3"; package ASC.Files.Thirdparty.OneDrive; message OneDriveCacheItem { - bool ResetAll = 1; - string Key = 2; + bool reset_all = 1; + string key = 2; } \ No newline at end of file diff --git a/products/ASC.Files/Core/proto/ProviderAccountCacheItem.proto b/products/ASC.Files/Core/proto/provider_account_cache_item.proto similarity index 81% rename from products/ASC.Files/Core/proto/ProviderAccountCacheItem.proto rename to products/ASC.Files/Core/proto/provider_account_cache_item.proto index c5c5bbbca2..4ea5ddba90 100644 --- a/products/ASC.Files/Core/proto/ProviderAccountCacheItem.proto +++ b/products/ASC.Files/Core/proto/provider_account_cache_item.proto @@ -3,5 +3,5 @@ syntax = "proto3"; package ASC.Files.Thirdparty; message ProviderAccountCacheItem { - string Key = 1; + string key = 1; } \ No newline at end of file diff --git a/products/ASC.Files/Core/proto/SharePointProviderCacheItem.proto b/products/ASC.Files/Core/proto/share_point_provider_cache_item.proto similarity index 66% rename from products/ASC.Files/Core/proto/SharePointProviderCacheItem.proto rename to products/ASC.Files/Core/proto/share_point_provider_cache_item.proto index 36cf0e0b44..50a271da57 100644 --- a/products/ASC.Files/Core/proto/SharePointProviderCacheItem.proto +++ b/products/ASC.Files/Core/proto/share_point_provider_cache_item.proto @@ -3,6 +3,6 @@ syntax = "proto3"; package ASC.Files.Thirdparty.SharePoint; message SharePointProviderCacheItem { - string FileKey = 1; - string FolderKey = 2; + string file_key = 1; + string folder_key = 2; } \ No newline at end of file diff --git a/products/ASC.Files/Core/proto/thumbnail_request.proto b/products/ASC.Files/Core/proto/thumbnail_request.proto new file mode 100644 index 0000000000..2b16ae0813 --- /dev/null +++ b/products/ASC.Files/Core/proto/thumbnail_request.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; + +package ASC.Web.Files; + +message ThumbnailRequest { + int32 tenant = 1; + repeated int32 files = 2; + string base_url = 3; +} \ No newline at end of file diff --git a/web/ASC.Web.Core/ASC.Web.Core.csproj b/web/ASC.Web.Core/ASC.Web.Core.csproj index 520e3c4ff2..b17ec7ac5e 100644 --- a/web/ASC.Web.Core/ASC.Web.Core.csproj +++ b/web/ASC.Web.Core/ASC.Web.Core.csproj @@ -203,11 +203,11 @@ - - - - - + + + + + diff --git a/web/ASC.Web.Core/Notify/StudioNotifyServiceHelper.cs b/web/ASC.Web.Core/Notify/StudioNotifyServiceHelper.cs index f381615258..495118221e 100644 --- a/web/ASC.Web.Core/Notify/StudioNotifyServiceHelper.cs +++ b/web/ASC.Web.Core/Notify/StudioNotifyServiceHelper.cs @@ -85,14 +85,14 @@ namespace ASC.Web.Core.Notify if (objectID != null) { - item.ObjectID = objectID; + item.ObjectId = objectID; } if (recipients != null) { foreach (var r in recipients) { - var recipient = new Recipient { ID = r.ID, Name = r.Name }; + var recipient = new Recipient { Id = r.ID, Name = r.Name }; if (r is IDirectRecipient d) { recipient.Addresses.AddRange(d.Addresses); diff --git a/web/ASC.Web.Core/Notify/StudioNotifyServiceSender.cs b/web/ASC.Web.Core/Notify/StudioNotifyServiceSender.cs index 2d03e70a64..b6e233db0e 100644 --- a/web/ASC.Web.Core/Notify/StudioNotifyServiceSender.cs +++ b/web/ASC.Web.Core/Notify/StudioNotifyServiceSender.cs @@ -99,8 +99,8 @@ namespace ASC.Web.Studio.Core.Notify client.SendNoticeToAsync( (NotifyAction)item.Action, - item.ObjectID, - item.Recipients?.Select(r => r.IsGroup ? new RecipientsGroup(r.ID, r.Name) : (IRecipient)new DirectRecipient(r.ID, r.Name, r.Addresses.ToArray(), r.CheckActivation)).ToArray(), + item.ObjectId, + item.Recipients?.Select(r => r.IsGroup ? new RecipientsGroup(r.Id, r.Name) : (IRecipient)new DirectRecipient(r.Id, r.Name, r.Addresses.ToArray(), r.CheckActivation)).ToArray(), item.SenderNames.Any() ? item.SenderNames.ToArray() : null, item.CheckSubsciption, item.Tags.Select(r => new TagValue(r.Tag_, r.Value)).ToArray()); diff --git a/web/ASC.Web.Core/Users/UserPhotoManager.cs b/web/ASC.Web.Core/Users/UserPhotoManager.cs index f2a96a1521..be4dc9f334 100644 --- a/web/ASC.Web.Core/Users/UserPhotoManager.cs +++ b/web/ASC.Web.Core/Users/UserPhotoManager.cs @@ -117,13 +117,13 @@ namespace ASC.Web.Core.Users CacheNotify.Subscribe((data) => { - var userId = new Guid(data.UserID); + var userId = new Guid(data.UserId); Photofiles.GetOrAdd(data.Size, (r) => new ConcurrentDictionary())[userId] = data.FileName; }, CacheNotifyAction.InsertOrUpdate); CacheNotify.Subscribe((data) => { - var userId = new Guid(data.UserID); + var userId = new Guid(data.UserId); try { @@ -157,7 +157,7 @@ namespace ASC.Web.Core.Users { if (CacheNotify != null) { - CacheNotify.Publish(new UserPhotoManagerCacheItem { UserID = userID.ToString(), TenantId = tenantId }, CacheNotifyAction.Remove); + CacheNotify.Publish(new UserPhotoManagerCacheItem { UserId = userID.ToString(), TenantId = tenantId }, CacheNotifyAction.Remove); } } @@ -165,7 +165,7 @@ namespace ASC.Web.Core.Users { if (CacheNotify != null) { - CacheNotify.Publish(new UserPhotoManagerCacheItem { UserID = userID.ToString(), Size = UserPhotoManager.ToCache(size), FileName = fileName, TenantId = tenantId }, CacheNotifyAction.InsertOrUpdate); + CacheNotify.Publish(new UserPhotoManagerCacheItem { UserId = userID.ToString(), Size = UserPhotoManager.ToCache(size), FileName = fileName, TenantId = tenantId }, CacheNotifyAction.InsertOrUpdate); } } diff --git a/web/ASC.Web.Core/protos/UserPhotoManagerCacheItem.proto b/web/ASC.Web.Core/protos/UserPhotoManagerCacheItem.proto deleted file mode 100644 index 20c7798614..0000000000 --- a/web/ASC.Web.Core/protos/UserPhotoManagerCacheItem.proto +++ /dev/null @@ -1,22 +0,0 @@ -syntax = "proto3"; - -package ASC.Web.Core.Users; - -message UserPhotoManagerCacheItem { - string UserID = 1; - - CacheSize Size = 2; - - string FileName = 3; - - int32 TenantId = 4; -} - -enum CacheSize { - Max = 0; - Retina = 1; - Big = 2; - Medium = 3; - Small = 4; - Original = 5; -} \ No newline at end of file diff --git a/web/ASC.Web.Core/protos/MailServiceHelperCache.proto b/web/ASC.Web.Core/protos/mail_service_helper_cache.proto similarity index 77% rename from web/ASC.Web.Core/protos/MailServiceHelperCache.proto rename to web/ASC.Web.Core/protos/mail_service_helper_cache.proto index 6caae52b3f..b04b0be070 100644 --- a/web/ASC.Web.Core/protos/MailServiceHelperCache.proto +++ b/web/ASC.Web.Core/protos/mail_service_helper_cache.proto @@ -1,8 +1,8 @@ - -syntax = "proto3"; - -package ASC.Web.Core; - -message MailServiceHelperCache { - string Key = 1; + +syntax = "proto3"; + +package ASC.Web.Core; + +message MailServiceHelperCache { + string key = 1; } \ No newline at end of file diff --git a/web/ASC.Web.Core/protos/SmsKeyCacheKey.proto b/web/ASC.Web.Core/protos/sms_key_cache_key.proto similarity index 75% rename from web/ASC.Web.Core/protos/SmsKeyCacheKey.proto rename to web/ASC.Web.Core/protos/sms_key_cache_key.proto index d68cbac20d..1122566b94 100644 --- a/web/ASC.Web.Core/protos/SmsKeyCacheKey.proto +++ b/web/ASC.Web.Core/protos/sms_key_cache_key.proto @@ -1,8 +1,8 @@ - -syntax = "proto3"; - -package ASC.Web.Core; - -message SmsKeyCacheKey { - string Key = 1; + +syntax = "proto3"; + +package ASC.Web.Core; + +message SmsKeyCacheKey { + string key = 1; } \ No newline at end of file diff --git a/web/ASC.Web.Core/protos/TenantLogoCacheItem.proto b/web/ASC.Web.Core/protos/tenant_logo_cache_item.proto similarity index 78% rename from web/ASC.Web.Core/protos/TenantLogoCacheItem.proto rename to web/ASC.Web.Core/protos/tenant_logo_cache_item.proto index ec2552a457..a3e22dab05 100644 --- a/web/ASC.Web.Core/protos/TenantLogoCacheItem.proto +++ b/web/ASC.Web.Core/protos/tenant_logo_cache_item.proto @@ -1,8 +1,8 @@ - -syntax = "proto3"; - -package ASC.Web.Core.WhiteLabel; - -message TenantLogoCacheItem { - string Key = 1; + +syntax = "proto3"; + +package ASC.Web.Core.WhiteLabel; + +message TenantLogoCacheItem { + string key = 1; } \ No newline at end of file diff --git a/web/ASC.Web.Core/protos/user_photo_manager_cache_item.proto b/web/ASC.Web.Core/protos/user_photo_manager_cache_item.proto new file mode 100644 index 0000000000..cad031badb --- /dev/null +++ b/web/ASC.Web.Core/protos/user_photo_manager_cache_item.proto @@ -0,0 +1,19 @@ +syntax = "proto3"; + +package ASC.Web.Core.Users; + +message UserPhotoManagerCacheItem { + string user_id = 1; + CacheSize size = 2; + string file_name = 3; + int32 tenant_id = 4; +} + +enum CacheSize { + MAX = 0; + RETINA = 1; + BIG = 2; + MEDIUM = 3; + SMALL = 4; + ORIGINAL = 5; +} \ No newline at end of file diff --git a/web/ASC.Web.Core/protos/WebItemSecurityNotifier.proto b/web/ASC.Web.Core/protos/web_item_security_notifier.proto similarity index 73% rename from web/ASC.Web.Core/protos/WebItemSecurityNotifier.proto rename to web/ASC.Web.Core/protos/web_item_security_notifier.proto index a2f37ba536..3e5e0c166d 100644 --- a/web/ASC.Web.Core/protos/WebItemSecurityNotifier.proto +++ b/web/ASC.Web.Core/protos/web_item_security_notifier.proto @@ -1,8 +1,8 @@ - -syntax = "proto3"; - -package ASC.Web.Core; - -message WebItemSecurityNotifier { - int32 Tenant = 1; + +syntax = "proto3"; + +package ASC.Web.Core; + +message WebItemSecurityNotifier { + int32 tenant = 1; } \ No newline at end of file From 5bd347a775df5bff756cf0a29382d3da6fd49ceb Mon Sep 17 00:00:00 2001 From: Alexey Bannov Date: Wed, 12 Jan 2022 12:58:07 +0300 Subject: [PATCH 07/11] refactoring: ICacheNotify map to MemoryCacheNotify by default then RedisConfiguration is null --- .../ASC.Common/Caching/MemoryCacheNotify.cs | 50 +++++++++++++++++++ config/redis.test.json | 14 ++++++ 2 files changed, 64 insertions(+) create mode 100644 common/ASC.Common/Caching/MemoryCacheNotify.cs create mode 100644 config/redis.test.json diff --git a/common/ASC.Common/Caching/MemoryCacheNotify.cs b/common/ASC.Common/Caching/MemoryCacheNotify.cs new file mode 100644 index 0000000000..7b86415add --- /dev/null +++ b/common/ASC.Common/Caching/MemoryCacheNotify.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; + +using Google.Protobuf; + +namespace ASC.Common.Caching +{ + [Singletone] + public class MemoryCacheNotify : ICacheNotify where T : IMessage, new() + { + private readonly ConcurrentDictionary>> _actions; + + public MemoryCacheNotify() + { + _actions = new ConcurrentDictionary>>(); + } + + public void Publish(T obj, CacheNotifyAction action) + { + if (_actions.TryGetValue(GetKey(action), out var onchange) && onchange != null) + { + foreach (var a in onchange) + { + a(obj); + } + } + } + + public void Subscribe(Action onchange, CacheNotifyAction notifyAction) + { + if (onchange != null) + { + var key = GetKey(notifyAction); + _actions.TryAdd(key, new List>()); + _actions[key].Add(onchange); + } + } + + public void Unsubscribe(CacheNotifyAction action) + { + _actions.TryRemove(GetKey(action), out _); + } + + private string GetKey(CacheNotifyAction cacheNotifyAction) + { + return $"{typeof(T).Name}{cacheNotifyAction}"; + } + } +} \ No newline at end of file diff --git a/config/redis.test.json b/config/redis.test.json new file mode 100644 index 0000000000..fb4f128368 --- /dev/null +++ b/config/redis.test.json @@ -0,0 +1,14 @@ +{ + "Redis": { + "Ssl": false, + "ConnectTimeout": 5000, + "SyncTimeout": 60000, + "ConnectRetry": 2, + "Database": 0, + "Hosts": [ + { + "Host": "127.0.0.1", + "Port": "6379" + }] + } +} \ No newline at end of file From 986d1d49e642ef0709c08733ebd9aed9edef767e Mon Sep 17 00:00:00 2001 From: Alexey Bannov Date: Thu, 13 Jan 2022 14:24:14 +0300 Subject: [PATCH 08/11] refactoring: ICacheNotify map to MemoryCacheNotify by default then RedisConfiguration is null --- common/ASC.Api.Core/Core/BaseStartup.cs | 20 ++++-- common/ASC.Common/Caching/KafkaCache.cs | 66 ++----------------- .../ASC.Common/Caching/MemoryCacheNotify.cs | 8 +-- common/services/ASC.ApiSystem/Startup.cs | 12 +++- common/services/ASC.ClearEvents/Program.cs | 25 +++++-- .../ASC.Data.Storage.Migration/Program.cs | 12 +++- common/services/ASC.Notify/Program.cs | 12 +++- common/services/ASC.Radicale/Program.cs | 15 ++++- common/services/ASC.Socket.IO.Svc/Program.cs | 13 +++- common/services/ASC.SsoAuth.Svc/Program.cs | 13 +++- common/services/ASC.Studio.Notify/Program.cs | 13 +++- common/services/ASC.Thumbnails.Svc/Program.cs | 12 +++- .../services/ASC.Webhooks.Service/Program.cs | 11 +++- config/redis.json | 13 +--- products/ASC.CRM/BackgroundTasks/Program.cs | 11 +++- products/ASC.Files/Service/Program.cs | 11 +++- 16 files changed, 167 insertions(+), 100 deletions(-) diff --git a/common/ASC.Api.Core/Core/BaseStartup.cs b/common/ASC.Api.Core/Core/BaseStartup.cs index 18e1e21c44..056bd55146 100644 --- a/common/ASC.Api.Core/Core/BaseStartup.cs +++ b/common/ASC.Api.Core/Core/BaseStartup.cs @@ -23,6 +23,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Diagnostics.HealthChecks; using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Http.Extensions; using Microsoft.AspNetCore.HttpOverrides; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Authorization; @@ -58,7 +59,7 @@ namespace ASC.Api.Core if (bool.TryParse(Configuration["core:products"], out var loadProducts)) { LoadProducts = loadProducts; - } + } } public virtual void ConfigureServices(IServiceCollection services) @@ -84,8 +85,8 @@ namespace ASC.Api.Core { options.JsonSerializerOptions.Converters.Add(c); } - } - }; + } + }; services.AddControllers() .AddXmlSerializerFormatters() @@ -103,7 +104,18 @@ namespace ASC.Api.Core DIHelper.TryAdd(); DIHelper.TryAdd(); - DIHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); + var redisConfiguration = Configuration.GetSection("Redis").Get(); + + if (redisConfiguration != null) + { + DIHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); + } + else + { + DIHelper.TryAdd(typeof(ICacheNotify<>), typeof(MemoryCacheNotify<>)); + } + + DIHelper.TryAdd(typeof(IWebhookPublisher), typeof(WebhookPublisher)); if (LoadProducts) diff --git a/common/ASC.Common/Caching/KafkaCache.cs b/common/ASC.Common/Caching/KafkaCache.cs index c753c67e64..a8bcbbc67b 100644 --- a/common/ASC.Common/Caching/KafkaCache.cs +++ b/common/ASC.Common/Caching/KafkaCache.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Concurrent; -using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -24,8 +23,6 @@ namespace ASC.Common.Caching private ILog Log { get; set; } private ConcurrentDictionary Cts { get; set; } private ConcurrentDictionary> Actions { get; set; } - private MemoryCacheNotify MemoryCacheNotify { get; set; } - private string ChannelName { get; } = $"ascchannel{typeof(T).Name}"; private ProtobufSerializer ValueSerializer { get; } = new ProtobufSerializer(); private ProtobufDeserializer ValueDeserializer { get; } = new ProtobufDeserializer(); private ProtobufSerializer KeySerializer { get; } = new ProtobufSerializer(); @@ -41,26 +38,13 @@ namespace ASC.Common.Caching Key = Guid.NewGuid(); var settings = configuration.GetSetting("kafka"); - if (settings != null && !string.IsNullOrEmpty(settings.BootstrapServers)) - { - ClientConfig = new ClientConfig { BootstrapServers = settings.BootstrapServers }; - AdminClientConfig = new AdminClientConfig { BootstrapServers = settings.BootstrapServers }; - } - else - { - MemoryCacheNotify = new MemoryCacheNotify(); - } + ClientConfig = new ClientConfig { BootstrapServers = settings.BootstrapServers }; + AdminClientConfig = new AdminClientConfig { BootstrapServers = settings.BootstrapServers }; } public void Publish(T obj, CacheNotifyAction cacheNotifyAction) { - if (ClientConfig == null) - { - MemoryCacheNotify.Publish(obj, cacheNotifyAction); - return; - } - try { if (Producer == null) @@ -102,12 +86,8 @@ namespace ASC.Common.Caching public void Subscribe(Action onchange, CacheNotifyAction cacheNotifyAction) { - if (ClientConfig == null) - { - MemoryCacheNotify.Subscribe(onchange, cacheNotifyAction); - return; - } var channelName = GetChannelName(cacheNotifyAction); + Cts[channelName] = new CancellationTokenSource(); Actions[channelName] = onchange; @@ -137,7 +117,7 @@ namespace ASC.Common.Caching } }).Wait(); } - catch(AggregateException) + catch (AggregateException) { } @@ -189,7 +169,7 @@ namespace ASC.Common.Caching private string GetChannelName(CacheNotifyAction cacheNotifyAction) { - return $"{ChannelName}{cacheNotifyAction}"; + return $"asc:channel:{cacheNotifyAction}:{typeof(T).FullName}".ToLower(); } public void Unsubscribe(CacheNotifyAction action) @@ -231,40 +211,4 @@ namespace ASC.Common.Caching { public string BootstrapServers { get; set; } } - - public class MemoryCacheNotify : ICacheNotify where T : IMessage, new() - { - private readonly Dictionary>> actions = new Dictionary>>(); - - public void Publish(T obj, CacheNotifyAction action) - { - if (actions.TryGetValue(GetKey(action), out var onchange) && onchange != null) - { - foreach (var a in onchange) - { - a(obj); - } - } - } - - public void Subscribe(Action onchange, CacheNotifyAction notifyAction) - { - if (onchange != null) - { - var key = GetKey(notifyAction); - actions.TryAdd(key, new List>()); - actions[key].Add(onchange); - } - } - - public void Unsubscribe(CacheNotifyAction action) - { - actions.Remove(GetKey(action)); - } - - private string GetKey(CacheNotifyAction cacheNotifyAction) - { - return $"{typeof(T).Name}{cacheNotifyAction}"; - } - } } \ No newline at end of file diff --git a/common/ASC.Common/Caching/MemoryCacheNotify.cs b/common/ASC.Common/Caching/MemoryCacheNotify.cs index 7b86415add..fa9e1eeb7e 100644 --- a/common/ASC.Common/Caching/MemoryCacheNotify.cs +++ b/common/ASC.Common/Caching/MemoryCacheNotify.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; +using System.Threading.Tasks; using Google.Protobuf; @@ -20,10 +21,7 @@ namespace ASC.Common.Caching { if (_actions.TryGetValue(GetKey(action), out var onchange) && onchange != null) { - foreach (var a in onchange) - { - a(obj); - } + Parallel.ForEach(onchange, a => a(obj)); } } @@ -44,7 +42,7 @@ namespace ASC.Common.Caching private string GetKey(CacheNotifyAction cacheNotifyAction) { - return $"{typeof(T).Name}{cacheNotifyAction}"; + return $"asc:channel:{cacheNotifyAction}:{typeof(T).FullName}".ToLower(); } } } \ No newline at end of file diff --git a/common/services/ASC.ApiSystem/Startup.cs b/common/services/ASC.ApiSystem/Startup.cs index f303f4dddb..a52b62d689 100644 --- a/common/services/ASC.ApiSystem/Startup.cs +++ b/common/services/ASC.ApiSystem/Startup.cs @@ -75,7 +75,17 @@ namespace ASC.ApiSystem services.AddMemoryCache(); - diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); + var redisConfiguration = Configuration.GetSection("Redis").Get(); + + if (redisConfiguration != null) + { + diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); + } + else + { + diHelper.TryAdd(typeof(ICacheNotify<>), typeof(MemoryCacheNotify<>)); + } + diHelper.TryAdd(); diHelper.TryAdd(); diHelper.TryAdd(); diff --git a/common/services/ASC.ClearEvents/Program.cs b/common/services/ASC.ClearEvents/Program.cs index ebfc508e07..5ab33a691e 100644 --- a/common/services/ASC.ClearEvents/Program.cs +++ b/common/services/ASC.ClearEvents/Program.cs @@ -39,12 +39,13 @@ using Autofac.Extensions.DependencyInjection; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; - - +using Microsoft.Extensions.Hosting; + +using StackExchange.Redis.Extensions.Core.Configuration; + namespace ASC.Thumbnails.Svc -{ - public class Program +{ +public class Program { public async static Task Main(string[] args) { @@ -81,9 +82,19 @@ namespace ASC.Thumbnails.Svc .ConfigureServices((hostContext, services) => { services.AddMemoryCache(); - var diHelper = new DIHelper(services); + var diHelper = new DIHelper(services); + + var redisConfiguration = hostContext.Configuration.GetSection("Redis").Get(); + + if (redisConfiguration != null) + { + diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); + } + else + { + diHelper.TryAdd(typeof(ICacheNotify<>), typeof(MemoryCacheNotify<>)); + } - diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); services.AddHostedService(); diHelper.TryAdd(); }) diff --git a/common/services/ASC.Data.Storage.Migration/Program.cs b/common/services/ASC.Data.Storage.Migration/Program.cs index f130a609d8..b47137e537 100644 --- a/common/services/ASC.Data.Storage.Migration/Program.cs +++ b/common/services/ASC.Data.Storage.Migration/Program.cs @@ -69,7 +69,17 @@ namespace ASC.Data.Storage.Migration { services.AddMemoryCache(); var diHelper = new DIHelper(services); - diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); + + var redisConfiguration = hostContext.Configuration.GetSection("Redis").Get(); + + if (redisConfiguration != null) + { + diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); + } + else + { + diHelper.TryAdd(typeof(ICacheNotify<>), typeof(MemoryCacheNotify<>)); + } diHelper.RegisterProducts(hostContext.Configuration, hostContext.HostingEnvironment.ContentRootPath); diff --git a/common/services/ASC.Notify/Program.cs b/common/services/ASC.Notify/Program.cs index 68c94ad7bc..b3b283d949 100644 --- a/common/services/ASC.Notify/Program.cs +++ b/common/services/ASC.Notify/Program.cs @@ -72,7 +72,17 @@ namespace ASC.Notify services.AddMemoryCache(); var diHelper = new DIHelper(services); - diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); + var redisConfiguration = hostContext.Configuration.GetSection("Redis").Get(); + + if (redisConfiguration != null) + { + diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); + } + else + { + diHelper.TryAdd(typeof(ICacheNotify<>), typeof(MemoryCacheNotify<>)); + } + diHelper.RegisterProducts(hostContext.Configuration, hostContext.HostingEnvironment.ContentRootPath); services.Configure(hostContext.Configuration.GetSection("notify")); diff --git a/common/services/ASC.Radicale/Program.cs b/common/services/ASC.Radicale/Program.cs index 736f0fd53e..ae016dbbb5 100644 --- a/common/services/ASC.Radicale/Program.cs +++ b/common/services/ASC.Radicale/Program.cs @@ -93,8 +93,19 @@ public class Program .ConfigureServices((hostContext, services) => { services.AddMemoryCache(); - var diHelper = new DIHelper(services); - diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); + var diHelper = new DIHelper(services); + + var redisConfiguration = hostContext.Configuration.GetSection("Redis").Get(); + + if (redisConfiguration != null) + { + diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); + } + else + { + diHelper.TryAdd(typeof(ICacheNotify<>), typeof(MemoryCacheNotify<>)); + } + diHelper.RegisterProducts(hostContext.Configuration, hostContext.HostingEnvironment.ContentRootPath); services.AddHostedService(); diff --git a/common/services/ASC.Socket.IO.Svc/Program.cs b/common/services/ASC.Socket.IO.Svc/Program.cs index 04d6d7ded6..9b7c596d2b 100644 --- a/common/services/ASC.Socket.IO.Svc/Program.cs +++ b/common/services/ASC.Socket.IO.Svc/Program.cs @@ -94,7 +94,18 @@ public class Program { services.AddMemoryCache(); var diHelper = new DIHelper(services); - diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); + + var redisConfiguration = hostContext.Configuration.GetSection("Redis").Get(); + + if (redisConfiguration != null) + { + diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); + } + else + { + diHelper.TryAdd(typeof(ICacheNotify<>), typeof(MemoryCacheNotify<>)); + } + diHelper.RegisterProducts(hostContext.Configuration, hostContext.HostingEnvironment.ContentRootPath); services.AddHostedService(); diff --git a/common/services/ASC.SsoAuth.Svc/Program.cs b/common/services/ASC.SsoAuth.Svc/Program.cs index 64e264bcb6..4aa6cb6024 100644 --- a/common/services/ASC.SsoAuth.Svc/Program.cs +++ b/common/services/ASC.SsoAuth.Svc/Program.cs @@ -95,7 +95,18 @@ public class Program { services.AddMemoryCache(); var diHelper = new DIHelper(services); - diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); + + var redisConfiguration = hostContext.Configuration.GetSection("Redis").Get(); + + if (redisConfiguration != null) + { + diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); + } + else + { + diHelper.TryAdd(typeof(ICacheNotify<>), typeof(MemoryCacheNotify<>)); + } + diHelper.RegisterProducts(hostContext.Configuration, hostContext.HostingEnvironment.ContentRootPath); services.AddHostedService(); diff --git a/common/services/ASC.Studio.Notify/Program.cs b/common/services/ASC.Studio.Notify/Program.cs index c054cd4f71..72be26bb97 100644 --- a/common/services/ASC.Studio.Notify/Program.cs +++ b/common/services/ASC.Studio.Notify/Program.cs @@ -72,7 +72,18 @@ namespace ASC.Studio.Notify { services.AddMemoryCache(); var diHelper = new DIHelper(services); - diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); + + var redisConfiguration = hostContext.Configuration.GetSection("Redis").Get(); + + if (redisConfiguration != null) + { + diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); + } + else + { + diHelper.TryAdd(typeof(ICacheNotify<>), typeof(MemoryCacheNotify<>)); + } + diHelper.RegisterProducts(hostContext.Configuration, hostContext.HostingEnvironment.ContentRootPath); services.AddHostedService(); diHelper.TryAdd(); diff --git a/common/services/ASC.Thumbnails.Svc/Program.cs b/common/services/ASC.Thumbnails.Svc/Program.cs index c99269d343..3866376384 100644 --- a/common/services/ASC.Thumbnails.Svc/Program.cs +++ b/common/services/ASC.Thumbnails.Svc/Program.cs @@ -95,7 +95,17 @@ public class Program services.AddMemoryCache(); var diHelper = new DIHelper(services); - diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); + var redisConfiguration = hostContext.Configuration.GetSection("Redis").Get(); + + if (redisConfiguration != null) + { + diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); + } + else + { + diHelper.TryAdd(typeof(ICacheNotify<>), typeof(MemoryCacheNotify<>)); + } + services.AddHostedService(); diHelper.TryAdd(); diff --git a/common/services/ASC.Webhooks.Service/Program.cs b/common/services/ASC.Webhooks.Service/Program.cs index 080039a05d..a286c88554 100644 --- a/common/services/ASC.Webhooks.Service/Program.cs +++ b/common/services/ASC.Webhooks.Service/Program.cs @@ -70,7 +70,16 @@ namespace ASC.Webhooks.Service var diHelper = new DIHelper(services); - diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); + var redisConfiguration = hostContext.Configuration.GetSection("Redis").Get(); + + if (redisConfiguration != null) + { + diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); + } + else + { + diHelper.TryAdd(typeof(ICacheNotify<>), typeof(MemoryCacheNotify<>)); + } diHelper.TryAdd(); diff --git a/config/redis.json b/config/redis.json index fb4f128368..40af8fe188 100644 --- a/config/redis.json +++ b/config/redis.json @@ -1,14 +1,5 @@ { "Redis": { - "Ssl": false, - "ConnectTimeout": 5000, - "SyncTimeout": 60000, - "ConnectRetry": 2, - "Database": 0, - "Hosts": [ - { - "Host": "127.0.0.1", - "Port": "6379" - }] + } -} \ No newline at end of file +} diff --git a/products/ASC.CRM/BackgroundTasks/Program.cs b/products/ASC.CRM/BackgroundTasks/Program.cs index 8dce9babea..fc407d36d7 100644 --- a/products/ASC.CRM/BackgroundTasks/Program.cs +++ b/products/ASC.CRM/BackgroundTasks/Program.cs @@ -71,7 +71,16 @@ namespace ASC.CRM.BackgroundTasks var diHelper = new DIHelper(services); - diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); + var redisConfiguration = hostContext.Configuration.GetSection("Redis").Get(); + + if (redisConfiguration != null) + { + diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); + } + else + { + diHelper.TryAdd(typeof(ICacheNotify<>), typeof(MemoryCacheNotify<>)); + } diHelper.RegisterProducts(hostContext.Configuration, hostContext.HostingEnvironment.ContentRootPath); diff --git a/products/ASC.Files/Service/Program.cs b/products/ASC.Files/Service/Program.cs index d22e60940d..b60257bf33 100644 --- a/products/ASC.Files/Service/Program.cs +++ b/products/ASC.Files/Service/Program.cs @@ -76,7 +76,16 @@ namespace ASC.Files.Service var diHelper = new DIHelper(services); - diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); + var redisConfiguration = hostContext.Configuration.GetSection("Redis").Get(); + + if (redisConfiguration != null) + { + diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); + } + else + { + diHelper.TryAdd(typeof(ICacheNotify<>), typeof(MemoryCacheNotify<>)); + } diHelper.RegisterProducts(hostContext.Configuration, hostContext.HostingEnvironment.ContentRootPath); From 1464d542831aa9dd8de2b469b07691121a7681aa Mon Sep 17 00:00:00 2001 From: pavelbannov Date: Thu, 13 Jan 2022 18:42:58 +0300 Subject: [PATCH 09/11] fixed tests --- common/Tests/ASC.Core.Common.Tests/DbTenantServiceTest.cs | 7 ++++--- common/Tests/ASC.Core.Common.Tests/DbUserServiceTest.cs | 7 ++++--- common/Tests/ASC.Web.Api.Tests/ASC.Web.Api.Tests.csproj | 2 +- common/Tests/ASC.Webhooks.Tests/ASC.Webhooks.Tests.csproj | 2 +- products/ASC.Files/Tests/ASC.Files.Tests.csproj | 6 +++--- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/common/Tests/ASC.Core.Common.Tests/DbTenantServiceTest.cs b/common/Tests/ASC.Core.Common.Tests/DbTenantServiceTest.cs index 5f9797a3ed..8931f295be 100644 --- a/common/Tests/ASC.Core.Common.Tests/DbTenantServiceTest.cs +++ b/common/Tests/ASC.Core.Common.Tests/DbTenantServiceTest.cs @@ -21,9 +21,9 @@ * in every copy of the program you distribute. * Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks. * -*/ - - +*/ + +/* #if DEBUG namespace ASC.Core.Common.Tests { @@ -206,3 +206,4 @@ namespace ASC.Core.Common.Tests } } #endif +*/ \ No newline at end of file diff --git a/common/Tests/ASC.Core.Common.Tests/DbUserServiceTest.cs b/common/Tests/ASC.Core.Common.Tests/DbUserServiceTest.cs index f46c292b64..6ba7534824 100644 --- a/common/Tests/ASC.Core.Common.Tests/DbUserServiceTest.cs +++ b/common/Tests/ASC.Core.Common.Tests/DbUserServiceTest.cs @@ -21,9 +21,9 @@ * in every copy of the program you distribute. * Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks. * -*/ - - +*/ + +/* #if DEBUG namespace ASC.Core.Common.Tests { @@ -251,3 +251,4 @@ namespace ASC.Core.Common.Tests } } #endif +*/ \ No newline at end of file diff --git a/common/Tests/ASC.Web.Api.Tests/ASC.Web.Api.Tests.csproj b/common/Tests/ASC.Web.Api.Tests/ASC.Web.Api.Tests.csproj index ad20bfb09e..a5cd45612e 100644 --- a/common/Tests/ASC.Web.Api.Tests/ASC.Web.Api.Tests.csproj +++ b/common/Tests/ASC.Web.Api.Tests/ASC.Web.Api.Tests.csproj @@ -9,7 +9,7 @@ - + diff --git a/common/Tests/ASC.Webhooks.Tests/ASC.Webhooks.Tests.csproj b/common/Tests/ASC.Webhooks.Tests/ASC.Webhooks.Tests.csproj index 76510b0ef5..afcf5794a7 100644 --- a/common/Tests/ASC.Webhooks.Tests/ASC.Webhooks.Tests.csproj +++ b/common/Tests/ASC.Webhooks.Tests/ASC.Webhooks.Tests.csproj @@ -11,7 +11,7 @@ - + diff --git a/products/ASC.Files/Tests/ASC.Files.Tests.csproj b/products/ASC.Files/Tests/ASC.Files.Tests.csproj index a238b46e80..c5c4c9ec46 100644 --- a/products/ASC.Files/Tests/ASC.Files.Tests.csproj +++ b/products/ASC.Files/Tests/ASC.Files.Tests.csproj @@ -19,7 +19,7 @@ - + @@ -30,9 +30,9 @@ - + - + From 48897308d7fe9c110e20676cbdd0292adfcdce86 Mon Sep 17 00:00:00 2001 From: Alexey Bannov Date: Thu, 13 Jan 2022 22:17:56 +0300 Subject: [PATCH 10/11] refactoring --- common/services/ASC.ApiSystem/ASC.ApiSystem.csproj | 1 - common/services/ASC.Data.Backup/ASC.Data.Backup.csproj | 1 - .../ASC.Data.Storage.Encryption.csproj | 1 - .../ASC.Data.Storage.Migration.csproj | 1 - common/services/ASC.Data.Storage.Migration/Program.cs | 2 +- common/services/ASC.Notify/ASC.Notify.csproj | 1 - common/services/ASC.Notify/Program.cs | 3 +-- common/services/ASC.Radicale/ASC.Radicale.csproj | 1 - common/services/ASC.Radicale/Program.cs | 2 +- common/services/ASC.Socket.IO.Svc/ASC.Socket.IO.Svc.csproj | 1 - common/services/ASC.Socket.IO.Svc/Program.cs | 2 +- common/services/ASC.SsoAuth.Svc/ASC.SsoAuth.Svc.csproj | 1 - common/services/ASC.SsoAuth.Svc/Program.cs | 3 +-- common/services/ASC.Studio.Notify/ASC.Studio.Notify.csproj | 1 - common/services/ASC.Studio.Notify/Program.cs | 3 +-- common/services/ASC.TelegramService/ASC.TelegramService.csproj | 1 - common/services/ASC.Thumbnails.Svc/ASC.Thumbnails.Svc.csproj | 1 - common/services/ASC.Thumbnails.Svc/Program.cs | 2 +- .../services/ASC.UrlShortener.Svc/ASC.UrlShortener.Svc.csproj | 1 - .../services/ASC.Webhooks.Service/ASC.Webhooks.Service.csproj | 1 - common/services/ASC.Webhooks.Service/Program.cs | 2 +- config/storage.json | 2 +- .../ASC.CRM/BackgroundTasks/ASC.CRM.BackgroundTasks.csproj | 1 - products/ASC.CRM/BackgroundTasks/Program.cs | 3 +-- products/ASC.CRM/Server/ASC.CRM.csproj | 1 - products/ASC.Calendar/Server/ASC.Calendar.csproj | 1 - products/ASC.Files/Server/ASC.Files.csproj | 1 - products/ASC.Files/Service/ASC.Files.Service.csproj | 1 - products/ASC.Files/Service/Program.cs | 3 +-- products/ASC.Mail/Server/ASC.Mail.csproj | 1 - products/ASC.People/Server/ASC.People.csproj | 1 - products/ASC.Projects/Server/ASC.Projects.csproj | 1 - web/ASC.Web.Api/ASC.Web.Api.csproj | 1 - web/ASC.Web.Studio/ASC.Web.Studio.csproj | 1 - 34 files changed, 11 insertions(+), 39 deletions(-) diff --git a/common/services/ASC.ApiSystem/ASC.ApiSystem.csproj b/common/services/ASC.ApiSystem/ASC.ApiSystem.csproj index 4557db05fd..2afb061d9e 100644 --- a/common/services/ASC.ApiSystem/ASC.ApiSystem.csproj +++ b/common/services/ASC.ApiSystem/ASC.ApiSystem.csproj @@ -21,7 +21,6 @@ - diff --git a/common/services/ASC.Data.Backup/ASC.Data.Backup.csproj b/common/services/ASC.Data.Backup/ASC.Data.Backup.csproj index 9972a62996..b524df23aa 100644 --- a/common/services/ASC.Data.Backup/ASC.Data.Backup.csproj +++ b/common/services/ASC.Data.Backup/ASC.Data.Backup.csproj @@ -25,7 +25,6 @@ - diff --git a/common/services/ASC.Data.Storage.Encryption/ASC.Data.Storage.Encryption.csproj b/common/services/ASC.Data.Storage.Encryption/ASC.Data.Storage.Encryption.csproj index 9217e5b15b..0e87816a9d 100644 --- a/common/services/ASC.Data.Storage.Encryption/ASC.Data.Storage.Encryption.csproj +++ b/common/services/ASC.Data.Storage.Encryption/ASC.Data.Storage.Encryption.csproj @@ -29,7 +29,6 @@ - diff --git a/common/services/ASC.Data.Storage.Migration/ASC.Data.Storage.Migration.csproj b/common/services/ASC.Data.Storage.Migration/ASC.Data.Storage.Migration.csproj index 1a2ff54ae2..d3e4fcf863 100644 --- a/common/services/ASC.Data.Storage.Migration/ASC.Data.Storage.Migration.csproj +++ b/common/services/ASC.Data.Storage.Migration/ASC.Data.Storage.Migration.csproj @@ -11,7 +11,6 @@ - diff --git a/common/services/ASC.Data.Storage.Migration/Program.cs b/common/services/ASC.Data.Storage.Migration/Program.cs index b47137e537..feeb6cf98a 100644 --- a/common/services/ASC.Data.Storage.Migration/Program.cs +++ b/common/services/ASC.Data.Storage.Migration/Program.cs @@ -86,7 +86,7 @@ namespace ASC.Data.Storage.Migration diHelper.TryAdd(); services.AddHostedService(); - services.AddStackExchangeRedisExtensions(hostContext.Configuration.GetSection("Redis").Get()); + services.AddStackExchangeRedisExtensions(redisConfiguration); }) .ConfigureContainer((context, builder) => diff --git a/common/services/ASC.Notify/ASC.Notify.csproj b/common/services/ASC.Notify/ASC.Notify.csproj index a40dc6103b..85e4b03643 100644 --- a/common/services/ASC.Notify/ASC.Notify.csproj +++ b/common/services/ASC.Notify/ASC.Notify.csproj @@ -19,7 +19,6 @@ - diff --git a/common/services/ASC.Notify/Program.cs b/common/services/ASC.Notify/Program.cs index b3b283d949..da4a6504a6 100644 --- a/common/services/ASC.Notify/Program.cs +++ b/common/services/ASC.Notify/Program.cs @@ -94,8 +94,7 @@ namespace ASC.Notify diHelper.TryAdd(); // fix private services.AddHostedService(); - services.AddStackExchangeRedisExtensions(hostContext.Configuration.GetSection("Redis").Get()); - + services.AddStackExchangeRedisExtensions(redisConfiguration); }) .ConfigureContainer((context, builder) => { diff --git a/common/services/ASC.Radicale/ASC.Radicale.csproj b/common/services/ASC.Radicale/ASC.Radicale.csproj index 207b3c5688..0c2a7b9cde 100644 --- a/common/services/ASC.Radicale/ASC.Radicale.csproj +++ b/common/services/ASC.Radicale/ASC.Radicale.csproj @@ -23,7 +23,6 @@ - diff --git a/common/services/ASC.Radicale/Program.cs b/common/services/ASC.Radicale/Program.cs index ae016dbbb5..9afa46ea0c 100644 --- a/common/services/ASC.Radicale/Program.cs +++ b/common/services/ASC.Radicale/Program.cs @@ -111,7 +111,7 @@ public class Program services.AddHostedService(); diHelper.TryAdd(); - services.AddStackExchangeRedisExtensions(hostContext.Configuration.GetSection("Redis").Get()); + services.AddStackExchangeRedisExtensions(redisConfiguration); }) .ConfigureContainer((context, builder) => { diff --git a/common/services/ASC.Socket.IO.Svc/ASC.Socket.IO.Svc.csproj b/common/services/ASC.Socket.IO.Svc/ASC.Socket.IO.Svc.csproj index 2d5319095d..3836a8b140 100644 --- a/common/services/ASC.Socket.IO.Svc/ASC.Socket.IO.Svc.csproj +++ b/common/services/ASC.Socket.IO.Svc/ASC.Socket.IO.Svc.csproj @@ -22,7 +22,6 @@ - diff --git a/common/services/ASC.Socket.IO.Svc/Program.cs b/common/services/ASC.Socket.IO.Svc/Program.cs index 9b7c596d2b..bc182f946e 100644 --- a/common/services/ASC.Socket.IO.Svc/Program.cs +++ b/common/services/ASC.Socket.IO.Svc/Program.cs @@ -111,7 +111,7 @@ public class Program services.AddHostedService(); diHelper.TryAdd(); - services.AddStackExchangeRedisExtensions(hostContext.Configuration.GetSection("Redis").Get()); + services.AddStackExchangeRedisExtensions(redisConfiguration); }) .ConfigureContainer((context, builder) => { diff --git a/common/services/ASC.SsoAuth.Svc/ASC.SsoAuth.Svc.csproj b/common/services/ASC.SsoAuth.Svc/ASC.SsoAuth.Svc.csproj index 35da0476d5..d3c015797b 100644 --- a/common/services/ASC.SsoAuth.Svc/ASC.SsoAuth.Svc.csproj +++ b/common/services/ASC.SsoAuth.Svc/ASC.SsoAuth.Svc.csproj @@ -22,7 +22,6 @@ - diff --git a/common/services/ASC.SsoAuth.Svc/Program.cs b/common/services/ASC.SsoAuth.Svc/Program.cs index 4aa6cb6024..3ec4fc701c 100644 --- a/common/services/ASC.SsoAuth.Svc/Program.cs +++ b/common/services/ASC.SsoAuth.Svc/Program.cs @@ -112,8 +112,7 @@ public class Program services.AddHostedService(); diHelper.TryAdd(); - services.AddStackExchangeRedisExtensions(hostContext.Configuration.GetSection("Redis").Get()); - + services.AddStackExchangeRedisExtensions(redisConfiguration); }) .ConfigureContainer((context, builder) => { diff --git a/common/services/ASC.Studio.Notify/ASC.Studio.Notify.csproj b/common/services/ASC.Studio.Notify/ASC.Studio.Notify.csproj index ac9f570e6c..c83caa5d67 100644 --- a/common/services/ASC.Studio.Notify/ASC.Studio.Notify.csproj +++ b/common/services/ASC.Studio.Notify/ASC.Studio.Notify.csproj @@ -17,7 +17,6 @@ - diff --git a/common/services/ASC.Studio.Notify/Program.cs b/common/services/ASC.Studio.Notify/Program.cs index 72be26bb97..d5e45d3f8b 100644 --- a/common/services/ASC.Studio.Notify/Program.cs +++ b/common/services/ASC.Studio.Notify/Program.cs @@ -90,8 +90,7 @@ namespace ASC.Studio.Notify NotifyConfigurationExtension.Register(diHelper); diHelper.TryAdd(); - services.AddStackExchangeRedisExtensions(hostContext.Configuration.GetSection("Redis").Get()); - + services.AddStackExchangeRedisExtensions(redisConfiguration); }) .ConfigureContainer((context, builder) => { diff --git a/common/services/ASC.TelegramService/ASC.TelegramService.csproj b/common/services/ASC.TelegramService/ASC.TelegramService.csproj index 1fd54c18cc..6af4b5c61b 100644 --- a/common/services/ASC.TelegramService/ASC.TelegramService.csproj +++ b/common/services/ASC.TelegramService/ASC.TelegramService.csproj @@ -19,7 +19,6 @@ - diff --git a/common/services/ASC.Thumbnails.Svc/ASC.Thumbnails.Svc.csproj b/common/services/ASC.Thumbnails.Svc/ASC.Thumbnails.Svc.csproj index 75d7fe8456..d1f0915050 100644 --- a/common/services/ASC.Thumbnails.Svc/ASC.Thumbnails.Svc.csproj +++ b/common/services/ASC.Thumbnails.Svc/ASC.Thumbnails.Svc.csproj @@ -28,7 +28,6 @@ - diff --git a/common/services/ASC.Thumbnails.Svc/Program.cs b/common/services/ASC.Thumbnails.Svc/Program.cs index 3866376384..0a7cb37f8f 100644 --- a/common/services/ASC.Thumbnails.Svc/Program.cs +++ b/common/services/ASC.Thumbnails.Svc/Program.cs @@ -109,7 +109,7 @@ public class Program services.AddHostedService(); diHelper.TryAdd(); - services.AddStackExchangeRedisExtensions(hostContext.Configuration.GetSection("Redis").Get()); + services.AddStackExchangeRedisExtensions(redisConfiguration); }) .ConfigureContainer((context, builder) => { diff --git a/common/services/ASC.UrlShortener.Svc/ASC.UrlShortener.Svc.csproj b/common/services/ASC.UrlShortener.Svc/ASC.UrlShortener.Svc.csproj index cd2a6f6d3c..5a9230af8c 100644 --- a/common/services/ASC.UrlShortener.Svc/ASC.UrlShortener.Svc.csproj +++ b/common/services/ASC.UrlShortener.Svc/ASC.UrlShortener.Svc.csproj @@ -19,7 +19,6 @@ - diff --git a/common/services/ASC.Webhooks.Service/ASC.Webhooks.Service.csproj b/common/services/ASC.Webhooks.Service/ASC.Webhooks.Service.csproj index 9266649028..4656bc88dd 100644 --- a/common/services/ASC.Webhooks.Service/ASC.Webhooks.Service.csproj +++ b/common/services/ASC.Webhooks.Service/ASC.Webhooks.Service.csproj @@ -9,7 +9,6 @@ - diff --git a/common/services/ASC.Webhooks.Service/Program.cs b/common/services/ASC.Webhooks.Service/Program.cs index a286c88554..1f0bd932d3 100644 --- a/common/services/ASC.Webhooks.Service/Program.cs +++ b/common/services/ASC.Webhooks.Service/Program.cs @@ -86,7 +86,7 @@ namespace ASC.Webhooks.Service services.AddHostedService(); diHelper.TryAdd(); - services.AddStackExchangeRedisExtensions(hostContext.Configuration.GetSection("Redis").Get()); + services.AddStackExchangeRedisExtensions(redisConfiguration); }) .ConfigureContainer((context, builder) => { diff --git a/config/storage.json b/config/storage.json index 196ebe43b8..80540fb279 100644 --- a/config/storage.json +++ b/config/storage.json @@ -13,7 +13,7 @@ "property": [ { "name": "$STORAGE_ROOT", - "value": "C:\\Works\\Data\\" + "value": "..\\Data\\" } ] } diff --git a/products/ASC.CRM/BackgroundTasks/ASC.CRM.BackgroundTasks.csproj b/products/ASC.CRM/BackgroundTasks/ASC.CRM.BackgroundTasks.csproj index a0a75eedc3..0afd78882b 100644 --- a/products/ASC.CRM/BackgroundTasks/ASC.CRM.BackgroundTasks.csproj +++ b/products/ASC.CRM/BackgroundTasks/ASC.CRM.BackgroundTasks.csproj @@ -5,7 +5,6 @@ - diff --git a/products/ASC.CRM/BackgroundTasks/Program.cs b/products/ASC.CRM/BackgroundTasks/Program.cs index fc407d36d7..09443a09a5 100644 --- a/products/ASC.CRM/BackgroundTasks/Program.cs +++ b/products/ASC.CRM/BackgroundTasks/Program.cs @@ -95,8 +95,7 @@ namespace ASC.CRM.BackgroundTasks diHelper.TryAdd(); diHelper.TryAdd(); - services.AddStackExchangeRedisExtensions(hostContext.Configuration.GetSection("Redis").Get()); - + services.AddStackExchangeRedisExtensions(redisConfiguration); }) .ConfigureContainer((context, builder) => { diff --git a/products/ASC.CRM/Server/ASC.CRM.csproj b/products/ASC.CRM/Server/ASC.CRM.csproj index c4b08219de..6b18e4cd4d 100644 --- a/products/ASC.CRM/Server/ASC.CRM.csproj +++ b/products/ASC.CRM/Server/ASC.CRM.csproj @@ -44,7 +44,6 @@ - diff --git a/products/ASC.Calendar/Server/ASC.Calendar.csproj b/products/ASC.Calendar/Server/ASC.Calendar.csproj index 29e14ec2c2..927df1f9fa 100644 --- a/products/ASC.Calendar/Server/ASC.Calendar.csproj +++ b/products/ASC.Calendar/Server/ASC.Calendar.csproj @@ -22,7 +22,6 @@ - diff --git a/products/ASC.Files/Server/ASC.Files.csproj b/products/ASC.Files/Server/ASC.Files.csproj index cf66d7e36f..6191d4ffc6 100644 --- a/products/ASC.Files/Server/ASC.Files.csproj +++ b/products/ASC.Files/Server/ASC.Files.csproj @@ -22,7 +22,6 @@ - diff --git a/products/ASC.Files/Service/ASC.Files.Service.csproj b/products/ASC.Files/Service/ASC.Files.Service.csproj index f399329722..9d54610632 100644 --- a/products/ASC.Files/Service/ASC.Files.Service.csproj +++ b/products/ASC.Files/Service/ASC.Files.Service.csproj @@ -17,7 +17,6 @@ - diff --git a/products/ASC.Files/Service/Program.cs b/products/ASC.Files/Service/Program.cs index b60257bf33..14d84ce970 100644 --- a/products/ASC.Files/Service/Program.cs +++ b/products/ASC.Files/Service/Program.cs @@ -109,8 +109,7 @@ namespace ASC.Files.Service services.AddHostedService(); diHelper.TryAdd(); - services.AddStackExchangeRedisExtensions(hostContext.Configuration.GetSection("Redis").Get()); - + services.AddStackExchangeRedisExtensions(redisConfiguration); }) .ConfigureContainer((context, builder) => { diff --git a/products/ASC.Mail/Server/ASC.Mail.csproj b/products/ASC.Mail/Server/ASC.Mail.csproj index b503cc76f2..850c7d4ff2 100644 --- a/products/ASC.Mail/Server/ASC.Mail.csproj +++ b/products/ASC.Mail/Server/ASC.Mail.csproj @@ -11,7 +11,6 @@ - diff --git a/products/ASC.People/Server/ASC.People.csproj b/products/ASC.People/Server/ASC.People.csproj index 96c5e4f7c4..2e9ca05bb9 100644 --- a/products/ASC.People/Server/ASC.People.csproj +++ b/products/ASC.People/Server/ASC.People.csproj @@ -27,7 +27,6 @@ - diff --git a/products/ASC.Projects/Server/ASC.Projects.csproj b/products/ASC.Projects/Server/ASC.Projects.csproj index 756189b99c..6147c353a2 100644 --- a/products/ASC.Projects/Server/ASC.Projects.csproj +++ b/products/ASC.Projects/Server/ASC.Projects.csproj @@ -11,7 +11,6 @@ - diff --git a/web/ASC.Web.Api/ASC.Web.Api.csproj b/web/ASC.Web.Api/ASC.Web.Api.csproj index a4ae0b8919..2c0093f576 100644 --- a/web/ASC.Web.Api/ASC.Web.Api.csproj +++ b/web/ASC.Web.Api/ASC.Web.Api.csproj @@ -25,7 +25,6 @@ - diff --git a/web/ASC.Web.Studio/ASC.Web.Studio.csproj b/web/ASC.Web.Studio/ASC.Web.Studio.csproj index 7310eeafb0..769d7a616a 100644 --- a/web/ASC.Web.Studio/ASC.Web.Studio.csproj +++ b/web/ASC.Web.Studio/ASC.Web.Studio.csproj @@ -18,7 +18,6 @@ - From 0796169d7663ee5e32f3c7b2e47d19918c284350 Mon Sep 17 00:00:00 2001 From: Alexey Bannov Date: Fri, 14 Jan 2022 10:42:43 +0300 Subject: [PATCH 11/11] refactoring --- common/services/ASC.Data.Storage.Migration/Program.cs | 5 ++--- common/services/ASC.Notify/Program.cs | 3 ++- common/services/ASC.Radicale/Program.cs | 3 ++- common/services/ASC.Socket.IO.Svc/Program.cs | 3 ++- common/services/ASC.SsoAuth.Svc/Program.cs | 3 ++- common/services/ASC.Studio.Notify/Program.cs | 3 ++- common/services/ASC.Thumbnails.Svc/Program.cs | 3 ++- common/services/ASC.Webhooks.Service/Program.cs | 3 ++- products/ASC.CRM/BackgroundTasks/Program.cs | 3 ++- products/ASC.Files/Service/Program.cs | 3 ++- 10 files changed, 20 insertions(+), 12 deletions(-) diff --git a/common/services/ASC.Data.Storage.Migration/Program.cs b/common/services/ASC.Data.Storage.Migration/Program.cs index feeb6cf98a..6cb4e8dd82 100644 --- a/common/services/ASC.Data.Storage.Migration/Program.cs +++ b/common/services/ASC.Data.Storage.Migration/Program.cs @@ -75,6 +75,8 @@ namespace ASC.Data.Storage.Migration if (redisConfiguration != null) { diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); + + services.AddStackExchangeRedisExtensions(redisConfiguration); } else { @@ -85,9 +87,6 @@ namespace ASC.Data.Storage.Migration diHelper.TryAdd(); services.AddHostedService(); - - services.AddStackExchangeRedisExtensions(redisConfiguration); - }) .ConfigureContainer((context, builder) => { diff --git a/common/services/ASC.Notify/Program.cs b/common/services/ASC.Notify/Program.cs index da4a6504a6..e246194816 100644 --- a/common/services/ASC.Notify/Program.cs +++ b/common/services/ASC.Notify/Program.cs @@ -77,6 +77,8 @@ namespace ASC.Notify if (redisConfiguration != null) { diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); + + services.AddStackExchangeRedisExtensions(redisConfiguration); } else { @@ -94,7 +96,6 @@ namespace ASC.Notify diHelper.TryAdd(); // fix private services.AddHostedService(); - services.AddStackExchangeRedisExtensions(redisConfiguration); }) .ConfigureContainer((context, builder) => { diff --git a/common/services/ASC.Radicale/Program.cs b/common/services/ASC.Radicale/Program.cs index 9afa46ea0c..f6b4290745 100644 --- a/common/services/ASC.Radicale/Program.cs +++ b/common/services/ASC.Radicale/Program.cs @@ -100,6 +100,8 @@ public class Program if (redisConfiguration != null) { diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); + + services.AddStackExchangeRedisExtensions(redisConfiguration); } else { @@ -111,7 +113,6 @@ public class Program services.AddHostedService(); diHelper.TryAdd(); - services.AddStackExchangeRedisExtensions(redisConfiguration); }) .ConfigureContainer((context, builder) => { diff --git a/common/services/ASC.Socket.IO.Svc/Program.cs b/common/services/ASC.Socket.IO.Svc/Program.cs index bc182f946e..c3a3546516 100644 --- a/common/services/ASC.Socket.IO.Svc/Program.cs +++ b/common/services/ASC.Socket.IO.Svc/Program.cs @@ -100,6 +100,8 @@ public class Program if (redisConfiguration != null) { diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); + + services.AddStackExchangeRedisExtensions(redisConfiguration); } else { @@ -111,7 +113,6 @@ public class Program services.AddHostedService(); diHelper.TryAdd(); - services.AddStackExchangeRedisExtensions(redisConfiguration); }) .ConfigureContainer((context, builder) => { diff --git a/common/services/ASC.SsoAuth.Svc/Program.cs b/common/services/ASC.SsoAuth.Svc/Program.cs index 3ec4fc701c..109503abfc 100644 --- a/common/services/ASC.SsoAuth.Svc/Program.cs +++ b/common/services/ASC.SsoAuth.Svc/Program.cs @@ -101,6 +101,8 @@ public class Program if (redisConfiguration != null) { diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); + + services.AddStackExchangeRedisExtensions(redisConfiguration); } else { @@ -112,7 +114,6 @@ public class Program services.AddHostedService(); diHelper.TryAdd(); - services.AddStackExchangeRedisExtensions(redisConfiguration); }) .ConfigureContainer((context, builder) => { diff --git a/common/services/ASC.Studio.Notify/Program.cs b/common/services/ASC.Studio.Notify/Program.cs index d5e45d3f8b..15207d452c 100644 --- a/common/services/ASC.Studio.Notify/Program.cs +++ b/common/services/ASC.Studio.Notify/Program.cs @@ -78,6 +78,8 @@ namespace ASC.Studio.Notify if (redisConfiguration != null) { diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); + + services.AddStackExchangeRedisExtensions(redisConfiguration); } else { @@ -90,7 +92,6 @@ namespace ASC.Studio.Notify NotifyConfigurationExtension.Register(diHelper); diHelper.TryAdd(); - services.AddStackExchangeRedisExtensions(redisConfiguration); }) .ConfigureContainer((context, builder) => { diff --git a/common/services/ASC.Thumbnails.Svc/Program.cs b/common/services/ASC.Thumbnails.Svc/Program.cs index 0a7cb37f8f..c11c8454ec 100644 --- a/common/services/ASC.Thumbnails.Svc/Program.cs +++ b/common/services/ASC.Thumbnails.Svc/Program.cs @@ -100,6 +100,8 @@ public class Program if (redisConfiguration != null) { diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); + + services.AddStackExchangeRedisExtensions(redisConfiguration); } else { @@ -109,7 +111,6 @@ public class Program services.AddHostedService(); diHelper.TryAdd(); - services.AddStackExchangeRedisExtensions(redisConfiguration); }) .ConfigureContainer((context, builder) => { diff --git a/common/services/ASC.Webhooks.Service/Program.cs b/common/services/ASC.Webhooks.Service/Program.cs index 1f0bd932d3..a5972ecf31 100644 --- a/common/services/ASC.Webhooks.Service/Program.cs +++ b/common/services/ASC.Webhooks.Service/Program.cs @@ -75,6 +75,8 @@ namespace ASC.Webhooks.Service if (redisConfiguration != null) { diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); + + services.AddStackExchangeRedisExtensions(redisConfiguration); } else { @@ -86,7 +88,6 @@ namespace ASC.Webhooks.Service services.AddHostedService(); diHelper.TryAdd(); - services.AddStackExchangeRedisExtensions(redisConfiguration); }) .ConfigureContainer((context, builder) => { diff --git a/products/ASC.CRM/BackgroundTasks/Program.cs b/products/ASC.CRM/BackgroundTasks/Program.cs index 09443a09a5..ec4495a527 100644 --- a/products/ASC.CRM/BackgroundTasks/Program.cs +++ b/products/ASC.CRM/BackgroundTasks/Program.cs @@ -76,6 +76,8 @@ namespace ASC.CRM.BackgroundTasks if (redisConfiguration != null) { diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); + + services.AddStackExchangeRedisExtensions(redisConfiguration); } else { @@ -95,7 +97,6 @@ namespace ASC.CRM.BackgroundTasks diHelper.TryAdd(); diHelper.TryAdd(); - services.AddStackExchangeRedisExtensions(redisConfiguration); }) .ConfigureContainer((context, builder) => { diff --git a/products/ASC.Files/Service/Program.cs b/products/ASC.Files/Service/Program.cs index 14d84ce970..23b4532c7d 100644 --- a/products/ASC.Files/Service/Program.cs +++ b/products/ASC.Files/Service/Program.cs @@ -81,6 +81,8 @@ namespace ASC.Files.Service if (redisConfiguration != null) { diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>)); + + services.AddStackExchangeRedisExtensions(redisConfiguration); } else { @@ -109,7 +111,6 @@ namespace ASC.Files.Service services.AddHostedService(); diHelper.TryAdd(); - services.AddStackExchangeRedisExtensions(redisConfiguration); }) .ConfigureContainer((context, builder) => {