Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8256d6a681 |
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="FuzzySharp" Version="2.0.2" />
|
<PackageReference Include="FuzzySharp" Version="2.0.2" />
|
||||||
|
<PackageReference Include="HtmlAgilityPack" Version="1.11.71" />
|
||||||
<PackageReference Include="NetMQ" Version="4.0.1.13" />
|
<PackageReference Include="NetMQ" Version="4.0.1.13" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
using HtmlAgilityPack;
|
||||||
|
|
||||||
namespace Backend.Helper;
|
namespace Backend.Helper;
|
||||||
|
|
||||||
|
|||||||
@@ -245,16 +245,6 @@ public class DbHandler
|
|||||||
|
|
||||||
(string absolutePath, string connectionString) = CreateDiscardedDb(discardedDbHandlerSetting.ThreadId);
|
(string absolutePath, string connectionString) = CreateDiscardedDb(discardedDbHandlerSetting.ThreadId);
|
||||||
|
|
||||||
// Compress the databases if they're already filled.
|
|
||||||
if (GetDiscardedIndexesForSpecificDb(connectionString) >= 50_000_000 && !_compressing)
|
|
||||||
{
|
|
||||||
_compressing = true;
|
|
||||||
|
|
||||||
Compress(discardedDbHandlerSetting.ThreadId, absolutePath, connectionString);
|
|
||||||
|
|
||||||
_compressing = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
while (!_stop)
|
while (!_stop)
|
||||||
@@ -272,7 +262,13 @@ public class DbHandler
|
|||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
||||||
Compress(discardedDbHandlerSetting.ThreadId, absolutePath, connectionString);
|
InsertCompressedDatabase(discardedDbHandlerSetting.ThreadId, GetDiscardedIndexesForSpecificDb(connectionString));
|
||||||
|
|
||||||
|
int compressedDatabases = GetDatabasesHelper.GetTotalCompressedDatabases($"{_basePath}/Models");
|
||||||
|
|
||||||
|
CompressionHelper.CompressFile(absolutePath, $"{absolutePath}_{compressedDatabases}");
|
||||||
|
|
||||||
|
DropAndCreateDiscarded(discardedDbHandlerSetting.ThreadId);
|
||||||
|
|
||||||
_compressing = false;
|
_compressing = false;
|
||||||
}
|
}
|
||||||
@@ -289,18 +285,6 @@ public class DbHandler
|
|||||||
Console.WriteLine("Discarded DbHandler stopped.");
|
Console.WriteLine("Discarded DbHandler stopped.");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Compress(int threadNumber, string absolutePath, string connectionString)
|
|
||||||
{
|
|
||||||
InsertCompressedDatabase(threadNumber, GetDiscardedIndexesForSpecificDb(connectionString));
|
|
||||||
|
|
||||||
int compressedDatabases = GetDatabasesHelper.GetTotalCompressedDatabases($"{_basePath}/Models");
|
|
||||||
|
|
||||||
CompressionHelper.CompressFile(absolutePath, $"{absolutePath}_{compressedDatabases}");
|
|
||||||
|
|
||||||
DropAndCreateDiscarded(threadNumber);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void DropAndCreateDiscarded(int threadNumber)
|
private void DropAndCreateDiscarded(int threadNumber)
|
||||||
{
|
{
|
||||||
string databaseName = $"Data Source={_basePath}/Models/Discarded{threadNumber}.db";
|
string databaseName = $"Data Source={_basePath}/Models/Discarded{threadNumber}.db";
|
||||||
|
|||||||
Reference in New Issue
Block a user