diff --git a/DD.Persistence.Client/PersistenceClientFactory.cs b/DD.Persistence.Client/PersistenceClientFactory.cs index ad7c817..6e016cd 100644 --- a/DD.Persistence.Client/PersistenceClientFactory.cs +++ b/DD.Persistence.Client/PersistenceClientFactory.cs @@ -31,6 +31,8 @@ namespace DD.Persistence.Client httpClient = httpClientFactory.CreateClient(); httpClient.Authorize(configuration); + + httpClient.Timeout = TimeSpan.FromSeconds(6000); } public PersistenceClientFactory(IHttpClientFactory httpClientFactory, IAuthTokenFactory authTokenFactory, IServiceProvider provider, IConfiguration configuration) @@ -41,7 +43,9 @@ namespace DD.Persistence.Client var token = authTokenFactory.GetToken(); httpClient.Authorize(token); - } + + httpClient.Timeout = TimeSpan.FromSeconds(6000); + } /// /// Получить клиент для работы с уставками diff --git a/DD.Persistence.sln b/DD.Persistence.sln index 711aa6a..872ec0a 100644 --- a/DD.Persistence.sln +++ b/DD.Persistence.sln @@ -1,4 +1,3 @@ - Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.9.34714.143 @@ -19,6 +18,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DD.Persistence.Client", "DD EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DD.Persistence.App", "DD.Persistence.App\DD.Persistence.App.csproj", "{063238BF-E982-43FA-9DDB-7D7D279086D8}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Persistence.Benchmark", "Persistence.Benchmark\Persistence.Benchmark.csproj", "{27455F8C-6986-46F1-AD3E-B9D0C7AC85D1}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -57,6 +58,10 @@ Global {063238BF-E982-43FA-9DDB-7D7D279086D8}.Debug|Any CPU.Build.0 = Debug|Any CPU {063238BF-E982-43FA-9DDB-7D7D279086D8}.Release|Any CPU.ActiveCfg = Release|Any CPU {063238BF-E982-43FA-9DDB-7D7D279086D8}.Release|Any CPU.Build.0 = Release|Any CPU + {27455F8C-6986-46F1-AD3E-B9D0C7AC85D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {27455F8C-6986-46F1-AD3E-B9D0C7AC85D1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {27455F8C-6986-46F1-AD3E-B9D0C7AC85D1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {27455F8C-6986-46F1-AD3E-B9D0C7AC85D1}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Persistence.Benchmark/Database/BenchmarkDbContext.cs b/Persistence.Benchmark/Database/BenchmarkDbContext.cs index 96c4460..d9a532b 100644 --- a/Persistence.Benchmark/Database/BenchmarkDbContext.cs +++ b/Persistence.Benchmark/Database/BenchmarkDbContext.cs @@ -1,6 +1,6 @@ using Microsoft.EntityFrameworkCore; using Persistence.Benchmark.Database.Entities; -using Persistence.Database; +using DD.Persistence.Database; namespace Persistence.Benchmark.Database; public class BenchmarkDbContext : PersistenceDbContext diff --git a/Persistence.Benchmark/Persistence.Benchmark.csproj b/Persistence.Benchmark/Persistence.Benchmark.csproj index a240125..0a8f325 100644 --- a/Persistence.Benchmark/Persistence.Benchmark.csproj +++ b/Persistence.Benchmark/Persistence.Benchmark.csproj @@ -14,10 +14,11 @@ - - - - + + + + + diff --git a/Persistence.Benchmark/Program.cs b/Persistence.Benchmark/Program.cs index 6f9874b..d887886 100644 --- a/Persistence.Benchmark/Program.cs +++ b/Persistence.Benchmark/Program.cs @@ -1,7 +1,7 @@ using BenchmarkDotNet.Running; using Persistence.Benchmark; using Persistence.Benchmark.Tests; -using Persistence.API; +using DD.Persistence.API; using System.Runtime.InteropServices; public class Program diff --git a/Persistence.Benchmark/Tests/BaseIntegrationTest.cs b/Persistence.Benchmark/Tests/BaseIntegrationTest.cs index d627b58..1fe9ed8 100644 --- a/Persistence.Benchmark/Tests/BaseIntegrationTest.cs +++ b/Persistence.Benchmark/Tests/BaseIntegrationTest.cs @@ -1,6 +1,6 @@ using Microsoft.Extensions.DependencyInjection; -using Persistence.Database; -using Persistence.Database.Model; +using DD.Persistence.Database; +using DD.Persistence.Database.Model; using Xunit; namespace Persistence.Benchmark; diff --git a/Persistence.Benchmark/Tests/WitsDataTest.cs b/Persistence.Benchmark/Tests/WitsDataTest.cs index 5c675c2..0fcdc59 100644 --- a/Persistence.Benchmark/Tests/WitsDataTest.cs +++ b/Persistence.Benchmark/Tests/WitsDataTest.cs @@ -1,10 +1,10 @@ using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Engines; using Microsoft.Extensions.DependencyInjection; -using Persistence.Client; -using Persistence.Client.Clients; -using Persistence.Client.Clients.Interfaces; -using Persistence.Models; +using DD.Persistence.Client; +using DD.Persistence.Client.Clients; +using DD.Persistence.Client.Clients.Interfaces; +using DD.Persistence.Models; namespace Persistence.Benchmark.Tests; @@ -32,7 +32,8 @@ public class WitsDataTest try { //var data = GenerateData(1_000_000); - var response = await client.AddRange(data, CancellationToken.None); + var source = new CancellationTokenSource(TimeSpan.FromSeconds(6000)); + var response = await client.AddRange(data, source.Token); Console.WriteLine(response.ToString()); //var discriminatorId = data.FirstOrDefault()!.DiscriminatorId; //var date = DateTimeOffset.UtcNow.AddDays(-1); @@ -49,7 +50,7 @@ public class WitsDataTest [GlobalSetup] public void GenerateData() { - int countToCreate = 5_000_000; + int countToCreate = 80_000_000; var dtos = new List(); diff --git a/Persistence.Benchmark/WebAppFactoryFixture.cs b/Persistence.Benchmark/WebAppFactoryFixture.cs index 0096437..ad7a0a3 100644 --- a/Persistence.Benchmark/WebAppFactoryFixture.cs +++ b/Persistence.Benchmark/WebAppFactoryFixture.cs @@ -1,18 +1,17 @@ -using Microsoft.AspNetCore.Hosting; +using DD.Persistence.Client; +using DD.Persistence.Database.Model; +using DD.Persistence.Database.Postgres; +using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc.Testing; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Logging; -using Persistence.API; using Persistence.Benchmark.Database; -using Persistence.Client; -using Persistence.Database.Model; -using Persistence.Database.Postgres; namespace Persistence.Benchmark; -public class WebAppFactoryFixture : WebApplicationFactory +public class WebAppFactoryFixture : WebApplicationFactory { private string connectionString = string.Empty;