mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Give english names to the resources
This commit is contained in:
parent
dc36e4530a
commit
13bfdbadc6
@ -19,7 +19,7 @@ namespace Wabbajack.FileExtractor.Test
|
||||
service.AddSingleton<TemporaryFileManager, TemporaryFileManager>();
|
||||
service.AddSingleton(new ParallelOptions {MaxDegreeOfParallelism = Environment.ProcessorCount});
|
||||
service.AddAllSingleton<IResource, IResource<FileExtractor>, Resource<FileExtractor>>(s =>
|
||||
new Resource<FileExtractor>(2));
|
||||
new Resource<FileExtractor>("File Extractor", 2));
|
||||
service.AddSingleton<FileExtractor>();
|
||||
service.AddSingleton(new JsonSerializerOptions());
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ namespace Wabbajack.RateLimiter.Test
|
||||
//[Fact]
|
||||
public async Task BasicTaskTests()
|
||||
{
|
||||
var rateLimiter = new Resource<int>(2);
|
||||
var rateLimiter = new Resource<int>("Test Resource", 2);
|
||||
|
||||
var current = 0;
|
||||
var max = 0;
|
||||
@ -48,7 +48,7 @@ namespace Wabbajack.RateLimiter.Test
|
||||
//[Fact]
|
||||
public async Task TestBasicThroughput()
|
||||
{
|
||||
var rateLimiter = new Resource<int>(1, 1024 * 1024);
|
||||
var rateLimiter = new Resource<int>("Test Resource", 1, 1024 * 1024);
|
||||
|
||||
using var job = await rateLimiter.Begin( "Transferring", 1024 * 1024 * 5 / 2, CancellationToken.None);
|
||||
|
||||
@ -72,7 +72,7 @@ namespace Wabbajack.RateLimiter.Test
|
||||
//[Fact]
|
||||
public async Task TestParallelThroughput()
|
||||
{
|
||||
var rateLimiter = new Resource<int>(2, 1024 * 1024);
|
||||
var rateLimiter = new Resource<int>("Test Resource", 2, 1024 * 1024);
|
||||
|
||||
|
||||
|
||||
@ -100,7 +100,7 @@ namespace Wabbajack.RateLimiter.Test
|
||||
//[Fact]
|
||||
public async Task TestParallelThroughputWithLimitedTasks()
|
||||
{
|
||||
var rateLimiter = new Resource<int>(1, 1024 * 1024 * 4);;
|
||||
var rateLimiter = new Resource<int>("Test Resource", 1, 1024 * 1024 * 4);;
|
||||
|
||||
var sw = Stopwatch.StartNew();
|
||||
|
||||
|
@ -18,12 +18,14 @@ namespace Wabbajack.RateLimiter
|
||||
private long _totalUsed = 0;
|
||||
private readonly int _maxTasks;
|
||||
private readonly long _maxThroughput;
|
||||
public string Name => typeof(T).Name;
|
||||
private readonly string _humanName;
|
||||
public string Name => _humanName;
|
||||
|
||||
|
||||
|
||||
public Resource(int maxTasks = Int32.MaxValue, long maxThroughput = long.MaxValue)
|
||||
public Resource(string humanName, int maxTasks = Int32.MaxValue, long maxThroughput = long.MaxValue)
|
||||
{
|
||||
_humanName = humanName;
|
||||
_maxTasks = maxTasks;
|
||||
_maxThroughput = maxThroughput;
|
||||
|
||||
|
@ -15,7 +15,7 @@ namespace Wabbajack.Server.Lib
|
||||
{
|
||||
return services
|
||||
.AddAllSingleton<ITokenProvider<Dictionary<StorageSpace, FtpSite>>, IFtpSiteCredentials, FtpSiteCredentialsProvider>()
|
||||
.AddSingleton<IResource<IFtpSiteCredentials>>(s => new Resource<IFtpSiteCredentials>(8));
|
||||
.AddSingleton<IResource<IFtpSiteCredentials>>(s => new Resource<IFtpSiteCredentials>("FTP Uploads", 8));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -56,11 +56,11 @@ namespace Wabbajack.Services.OSIntegrated
|
||||
: new BinaryPatchCache(KnownFolders.EntryPoint.Combine("patchCache.sqlite")));
|
||||
|
||||
service.AddSingleton(new ParallelOptions {MaxDegreeOfParallelism = Environment.ProcessorCount});
|
||||
service.AddAllSingleton<IResource, IResource<DownloadDispatcher>>(s => new Resource<DownloadDispatcher>(12));
|
||||
service.AddAllSingleton<IResource, IResource<HttpClient>>(s => new Resource<HttpClient>(12));
|
||||
service.AddAllSingleton<IResource, IResource<Context>>(s => new Resource<Context>(12));
|
||||
service.AddAllSingleton<IResource, IResource<DownloadDispatcher>>(s => new Resource<DownloadDispatcher>("Downloads", 12));
|
||||
service.AddAllSingleton<IResource, IResource<HttpClient>>(s => new Resource<HttpClient>("Web Requests", 12));
|
||||
service.AddAllSingleton<IResource, IResource<Context>>(s => new Resource<Context>("VFS", 12));
|
||||
service.AddAllSingleton<IResource, IResource<FileExtractor.FileExtractor>>(s =>
|
||||
new Resource<FileExtractor.FileExtractor>(12));
|
||||
new Resource<FileExtractor.FileExtractor>("File Extractor", 12));
|
||||
|
||||
service.AddSingleton<LoggingRateLimiterReporter>();
|
||||
|
||||
|
@ -17,7 +17,7 @@ namespace Wabbajack.VFS.Test
|
||||
{
|
||||
service.AddSingleton<TemporaryFileManager, TemporaryFileManager>();
|
||||
service.AddAllSingleton<IResource, IResource<FileExtractor.FileExtractor>, Resource<FileExtractor.FileExtractor>>(s =>
|
||||
new Resource<FileExtractor.FileExtractor>(2));
|
||||
new Resource<FileExtractor.FileExtractor>("File Extractor", 2));
|
||||
|
||||
// Keep this fixed at 2 so that we can detect deadlocks in the VFS parallelOptions
|
||||
service.AddSingleton(new ParallelOptions {MaxDegreeOfParallelism = 2});
|
||||
|
Loading…
Reference in New Issue
Block a user