Skip to content

Commit

Permalink
Merge branch 'Nekromateion-indexer-patcher-thread-limits'
Browse files Browse the repository at this point in the history
# Conflicts:
#	AdGoBye/Settings.cs
#	AdGoBye/appsettings.json
  • Loading branch information
regalialong committed Jun 26, 2024
2 parents 3e6c34a + c8ea08e commit 6c1e79e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion AdGoBye/Indexer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public static void AddToIndex(string path)
public static void AddToIndex(IEnumerable<DirectoryInfo?> paths)
{
ConcurrentBag<Content> contents = [];
Parallel.ForEach(paths, path =>
Parallel.ForEach(paths, new ParallelOptions { MaxDegreeOfParallelism = Settings.Options.MaxIndexerThreads }, path =>
{
if (path != null && AddToIndexPart1(path.FullName, out var content) && content != null)
{
Expand Down
3 changes: 2 additions & 1 deletion AdGoBye/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
logger.Information("Loaded blocks for {blockCount} worlds and indexed {indexCount} pieces of content",
Blocklist.Blocks?.Count, db.Content.Count());

Parallel.ForEach(db.Content.Include(content => content.VersionMeta), content =>
Parallel.ForEach(db.Content.Include(content => content.VersionMeta),
new ParallelOptions { MaxDegreeOfParallelism = Settings.Options.MaxPatchThreads }, content =>
{
if (content.Type != ContentType.World) return;
Indexer.PatchContent(content);
Expand Down
2 changes: 2 additions & 0 deletions AdGoBye/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public class SettingsOptions
public bool DisablePluginInstallWarning { get; set; }
public bool DisableBackupFile { get; set; }
public bool EnableRecompression { get; set; }
public int MaxIndexerThreads { get; set; }
public int MaxPatchThreads { get; set; }
public int RecompressionMemoryMaxMB { get; set; }
public int ZipBombSizeLimitMB { get; set; }
}
Expand Down
2 changes: 2 additions & 0 deletions AdGoBye/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"BlocklistURLs": [],
"DisablePluginInstallWarning": false,
"EnableRecompression": true,
"MaxIndexerThreads": 16,
"MaxPatchThreads": 16,
"RecompressionMemoryMaxMB": 250,
"ZipBombSizeLimitMB": 8000
},
Expand Down

0 comments on commit 6c1e79e

Please sign in to comment.