diff --git a/src/Tgstation.Server.Host/Components/Chat/ChatManager.cs b/src/Tgstation.Server.Host/Components/Chat/ChatManager.cs
index 0231bc973e..7c27d08d39 100644
--- a/src/Tgstation.Server.Host/Components/Chat/ChatManager.cs
+++ b/src/Tgstation.Server.Host/Components/Chat/ChatManager.cs
@@ -631,8 +631,8 @@ namespace Tgstation.Server.Host.Components.Chat
///
/// The to remap channels for.
/// The for the operation.
- /// A representing the running operation.
- async Task RemapProvider(IProvider provider, CancellationToken cancellationToken)
+ /// A representing the running operation.
+ async ValueTask RemapProvider(IProvider provider, CancellationToken cancellationToken)
{
logger.LogTrace("Remapping channels for provider reconnection...");
IEnumerable channelsToMap;
@@ -654,9 +654,9 @@ namespace Tgstation.Server.Host.Components.Chat
/// The to process. If , this indicates the provider reconnected.
/// If we are called recursively after remapping the provider.
/// The for the operation.
- /// A representing the running operation.
+ /// A representing the running operation.
#pragma warning disable CA1502
- async Task ProcessMessage(IProvider provider, Message message, bool recursed, CancellationToken cancellationToken)
+ async ValueTask ProcessMessage(IProvider provider, Message message, bool recursed, CancellationToken cancellationToken)
#pragma warning restore CA1502
{
if (!provider.Connected)
diff --git a/src/Tgstation.Server.Host/Components/Deployment/DmbFactory.cs b/src/Tgstation.Server.Host/Components/Deployment/DmbFactory.cs
index 2b6e2d12b3..b4e333a41d 100644
--- a/src/Tgstation.Server.Host/Components/Deployment/DmbFactory.cs
+++ b/src/Tgstation.Server.Host/Components/Deployment/DmbFactory.cs
@@ -8,6 +8,7 @@ using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
+using Tgstation.Server.Common.Extensions;
using Tgstation.Server.Host.Components.Deployment.Remote;
using Tgstation.Server.Host.Components.Events;
using Tgstation.Server.Host.Database;
@@ -420,7 +421,7 @@ namespace Tgstation.Server.Host.Components.Deployment
{
try
{
- await Task.WhenAll(deleteTask, deploymentJob);
+ await ValueTaskExtensions.WhenAll(deleteTask, deploymentJob);
}
catch (Exception ex)
{
@@ -453,8 +454,8 @@ namespace Tgstation.Server.Host.Components.Deployment
///
/// The directory to cleanup.
/// The for this .
- /// The deletion .
- async Task DeleteCompileJobContent(string directory, CancellationToken cancellationToken)
+ /// The deletion .
+ async ValueTask DeleteCompileJobContent(string directory, CancellationToken cancellationToken)
{
// Then call the cleanup event, waiting here first
await eventConsumer.HandleEvent(EventType.DeploymentCleanup, new List { ioManager.ResolvePath(directory) }, true, cancellationToken);
diff --git a/src/Tgstation.Server.Host/Components/Deployment/DreamMaker.cs b/src/Tgstation.Server.Host/Components/Deployment/DreamMaker.cs
index 7454f410d7..6793fdfb7f 100644
--- a/src/Tgstation.Server.Host/Components/Deployment/DreamMaker.cs
+++ b/src/Tgstation.Server.Host/Components/Deployment/DreamMaker.cs
@@ -10,6 +10,7 @@ using Microsoft.Extensions.Logging;
using Tgstation.Server.Api.Models;
using Tgstation.Server.Api.Models.Internal;
+using Tgstation.Server.Common.Extensions;
using Tgstation.Server.Host.Components.Byond;
using Tgstation.Server.Host.Components.Chat;
using Tgstation.Server.Host.Components.Deployment.Remote;
@@ -390,7 +391,7 @@ namespace Tgstation.Server.Host.Components.Deployment
try
{
- await Task.WhenAll(commentsTask, eventTask);
+ await ValueTaskExtensions.WhenAll(commentsTask, eventTask);
}
catch (Exception ex)
{
@@ -950,10 +951,10 @@ namespace Tgstation.Server.Host.Components.Deployment
/// The running .
/// The associated with the .
/// The that was thrown.
- /// A representing the running operation.
- async Task CleanupFailedCompile(Models.CompileJob job, IRemoteDeploymentManager remoteDeploymentManager, Exception exception)
+ /// A representing the running operation.
+ ValueTask CleanupFailedCompile(Models.CompileJob job, IRemoteDeploymentManager remoteDeploymentManager, Exception exception)
{
- async Task CleanDir()
+ async ValueTask CleanDir()
{
logger.LogTrace("Cleaning compile directory...");
var jobPath = job.DirectoryName.ToString();
@@ -970,7 +971,7 @@ namespace Tgstation.Server.Host.Components.Deployment
}
// DCT: None available
- await Task.WhenAll(
+ return ValueTaskExtensions.WhenAll(
CleanDir(),
remoteDeploymentManager.FailDeployment(
job,
diff --git a/src/Tgstation.Server.Host/Components/Deployment/Remote/BaseRemoteDeploymentManager.cs b/src/Tgstation.Server.Host/Components/Deployment/Remote/BaseRemoteDeploymentManager.cs
index 6a4790a62e..db48c659ba 100644
--- a/src/Tgstation.Server.Host/Components/Deployment/Remote/BaseRemoteDeploymentManager.cs
+++ b/src/Tgstation.Server.Host/Components/Deployment/Remote/BaseRemoteDeploymentManager.cs
@@ -7,6 +7,7 @@ using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
+using Tgstation.Server.Common.Extensions;
using Tgstation.Server.Host.Components.Repository;
using Tgstation.Server.Host.Models;
@@ -49,7 +50,7 @@ namespace Tgstation.Server.Host.Components.Deployment.Remote
}
///
- public async Task PostDeploymentComments(
+ public async ValueTask PostDeploymentComments(
CompileJob compileJob,
RevisionInformation previousRevisionInformation,
RepositorySettings repositorySettings,
@@ -102,7 +103,7 @@ namespace Tgstation.Server.Host.Components.Deployment.Remote
removedTestMerges.Count,
updatedTestMerges.Count);
- var tasks = new List(addedTestMerges.Count + updatedTestMerges.Count + removedTestMerges.Count);
+ var tasks = new List(addedTestMerges.Count + updatedTestMerges.Count + removedTestMerges.Count);
foreach (var addedTestMerge in addedTestMerges)
tasks.Add(
CommentOnTestMergeSource(
@@ -146,11 +147,11 @@ namespace Tgstation.Server.Host.Components.Deployment.Remote
cancellationToken));
if (tasks.Any())
- await Task.WhenAll(tasks);
+ await ValueTaskExtensions.WhenAll(tasks);
}
///
- public Task ApplyDeployment(CompileJob compileJob, CancellationToken cancellationToken)
+ public ValueTask ApplyDeployment(CompileJob compileJob, CancellationToken cancellationToken)
{
ArgumentNullException.ThrowIfNull(compileJob);
@@ -161,10 +162,10 @@ namespace Tgstation.Server.Host.Components.Deployment.Remote
}
///
- public abstract Task FailDeployment(CompileJob compileJob, string errorMessage, CancellationToken cancellationToken);
+ public abstract ValueTask FailDeployment(CompileJob compileJob, string errorMessage, CancellationToken cancellationToken);
///
- public Task MarkInactive(CompileJob compileJob, CancellationToken cancellationToken)
+ public ValueTask MarkInactive(CompileJob compileJob, CancellationToken cancellationToken)
{
ArgumentNullException.ThrowIfNull(compileJob);
@@ -175,14 +176,14 @@ namespace Tgstation.Server.Host.Components.Deployment.Remote
}
///
- public abstract Task> RemoveMergedTestMerges(
+ public abstract ValueTask> RemoveMergedTestMerges(
IRepository repository,
RepositorySettings repositorySettings,
RevisionInformation revisionInformation,
CancellationToken cancellationToken);
///
- public Task StageDeployment(CompileJob compileJob, Action activationCallback, CancellationToken cancellationToken)
+ public ValueTask StageDeployment(CompileJob compileJob, Action activationCallback, CancellationToken cancellationToken)
{
ArgumentNullException.ThrowIfNull(compileJob);
@@ -193,7 +194,7 @@ namespace Tgstation.Server.Host.Components.Deployment.Remote
}
///
- public abstract Task StartDeployment(
+ public abstract ValueTask StartDeployment(
Api.Models.Internal.IGitRemoteInformation remoteInformation,
CompileJob compileJob,
CancellationToken cancellationToken);
@@ -203,24 +204,24 @@ namespace Tgstation.Server.Host.Components.Deployment.Remote
///
/// The staged .
/// The for the operation.
- /// A representing the running operation.
- protected abstract Task StageDeploymentImpl(CompileJob compileJob, CancellationToken cancellationToken);
+ /// A representing the running operation.
+ protected abstract ValueTask StageDeploymentImpl(CompileJob compileJob, CancellationToken cancellationToken);
///
/// Implementation of .
///
/// The being applied.
/// The for the operation.
- /// A representing the running operation.
- protected abstract Task ApplyDeploymentImpl(CompileJob compileJob, CancellationToken cancellationToken);
+ /// A representing the running operation.
+ protected abstract ValueTask ApplyDeploymentImpl(CompileJob compileJob, CancellationToken cancellationToken);
///
/// Implementation of .
///
/// The inactive .
/// The for the operation.
- /// A representing the running operation.
- protected abstract Task MarkInactiveImpl(CompileJob compileJob, CancellationToken cancellationToken);
+ /// A representing the running operation.
+ protected abstract ValueTask MarkInactiveImpl(CompileJob compileJob, CancellationToken cancellationToken);
///
/// Formats a comment for a given .
@@ -231,7 +232,7 @@ namespace Tgstation.Server.Host.Components.Deployment.Remote
/// The .
/// The .
/// If is new, otherwise it has been updated to a different .
- /// A representing the running operation.
+ /// A formatted for posting a informative comment about the .
protected abstract string FormatTestMerge(
RepositorySettings repositorySettings,
CompileJob compileJob,
@@ -249,8 +250,8 @@ namespace Tgstation.Server.Host.Components.Deployment.Remote
/// The comment to post.
/// The .
/// The for the operation.
- /// A representing the running operation.
- protected abstract Task CommentOnTestMergeSource(
+ /// A representing the running operation.
+ protected abstract ValueTask CommentOnTestMergeSource(
RepositorySettings repositorySettings,
string remoteRepositoryOwner,
string remoteRepositoryName,
diff --git a/src/Tgstation.Server.Host/Components/Deployment/Remote/GitHubRemoteDeploymentManager.cs b/src/Tgstation.Server.Host/Components/Deployment/Remote/GitHubRemoteDeploymentManager.cs
index aa9fc5c0a4..a31780bf21 100644
--- a/src/Tgstation.Server.Host/Components/Deployment/Remote/GitHubRemoteDeploymentManager.cs
+++ b/src/Tgstation.Server.Host/Components/Deployment/Remote/GitHubRemoteDeploymentManager.cs
@@ -55,7 +55,7 @@ namespace Tgstation.Server.Host.Components.Deployment.Remote
}
///
- public override async Task StartDeployment(
+ public override async ValueTask StartDeployment(
Api.Models.Internal.IGitRemoteInformation remoteInformation,
CompileJob compileJob,
CancellationToken cancellationToken)
@@ -148,7 +148,7 @@ namespace Tgstation.Server.Host.Components.Deployment.Remote
}
///
- public override Task FailDeployment(CompileJob compileJob, string errorMessage, CancellationToken cancellationToken)
+ public override ValueTask FailDeployment(CompileJob compileJob, string errorMessage, CancellationToken cancellationToken)
=> UpdateDeployment(
compileJob,
errorMessage,
@@ -156,7 +156,7 @@ namespace Tgstation.Server.Host.Components.Deployment.Remote
cancellationToken);
///
- public override async Task> RemoveMergedTestMerges(
+ public override async ValueTask> RemoveMergedTestMerges(
IRepository repository,
RepositorySettings repositorySettings,
RevisionInformation revisionInformation,
@@ -191,7 +191,7 @@ namespace Tgstation.Server.Host.Components.Deployment.Remote
var newList = revisionInformation.ActiveTestMerges.Select(x => x.TestMerge).ToList();
PullRequest lastMerged = null;
- async Task CheckRemovePR(Task task)
+ async ValueTask CheckRemovePR(Task task)
{
var pr = await task;
if (!pr.Merged)
@@ -215,7 +215,7 @@ namespace Tgstation.Server.Host.Components.Deployment.Remote
}
///
- protected override Task StageDeploymentImpl(
+ protected override ValueTask StageDeploymentImpl(
CompileJob compileJob,
CancellationToken cancellationToken)
=> UpdateDeployment(
@@ -225,7 +225,7 @@ namespace Tgstation.Server.Host.Components.Deployment.Remote
cancellationToken);
///
- protected override Task ApplyDeploymentImpl(CompileJob compileJob, CancellationToken cancellationToken)
+ protected override ValueTask ApplyDeploymentImpl(CompileJob compileJob, CancellationToken cancellationToken)
=> UpdateDeployment(
compileJob,
"The deployment is now live on the server.",
@@ -233,7 +233,7 @@ namespace Tgstation.Server.Host.Components.Deployment.Remote
cancellationToken);
///
- protected override Task MarkInactiveImpl(CompileJob compileJob, CancellationToken cancellationToken)
+ protected override ValueTask MarkInactiveImpl(CompileJob compileJob, CancellationToken cancellationToken)
=> UpdateDeployment(
compileJob,
"The deployment has been superceeded.",
@@ -241,7 +241,7 @@ namespace Tgstation.Server.Host.Components.Deployment.Remote
cancellationToken);
///
- protected override async Task CommentOnTestMergeSource(
+ protected override async ValueTask CommentOnTestMergeSource(
RepositorySettings repositorySettings,
string remoteRepositoryOwner,
string remoteRepositoryName,
@@ -302,8 +302,8 @@ namespace Tgstation.Server.Host.Components.Deployment.Remote
/// A description of the update.
/// The new .
/// The for the operation.
- /// A representing the running operation.
- async Task UpdateDeployment(
+ /// A representing the running operation.
+ async ValueTask UpdateDeployment(
CompileJob compileJob,
string description,
DeploymentState deploymentState,
diff --git a/src/Tgstation.Server.Host/Components/Deployment/Remote/GitLabRemoteDeploymentManager.cs b/src/Tgstation.Server.Host/Components/Deployment/Remote/GitLabRemoteDeploymentManager.cs
index 18e172c122..3154b2ee03 100644
--- a/src/Tgstation.Server.Host/Components/Deployment/Remote/GitLabRemoteDeploymentManager.cs
+++ b/src/Tgstation.Server.Host/Components/Deployment/Remote/GitLabRemoteDeploymentManager.cs
@@ -36,7 +36,7 @@ namespace Tgstation.Server.Host.Components.Deployment.Remote
}
///
- public override async Task> RemoveMergedTestMerges(
+ public override async ValueTask> RemoveMergedTestMerges(
IRepository repository,
RepositorySettings repositorySettings,
RevisionInformation revisionInformation,
@@ -76,7 +76,7 @@ namespace Tgstation.Server.Host.Components.Deployment.Remote
var newList = revisionInformation.ActiveTestMerges.Select(x => x.TestMerge).ToList();
MergeRequest lastMerged = null;
- async Task CheckRemoveMR(Task task)
+ async ValueTask CheckRemoveMR(Task task)
{
var mergeRequest = await task;
if (mergeRequest.State != MergeRequestState.Merged)
@@ -100,30 +100,30 @@ namespace Tgstation.Server.Host.Components.Deployment.Remote
}
///
- public override Task FailDeployment(
+ public override ValueTask FailDeployment(
CompileJob compileJob,
string errorMessage,
- CancellationToken cancellationToken) => Task.CompletedTask;
+ CancellationToken cancellationToken) => ValueTask.CompletedTask;
///
- public override Task StartDeployment(
+ public override ValueTask StartDeployment(
Api.Models.Internal.IGitRemoteInformation remoteInformation,
CompileJob compileJob,
- CancellationToken cancellationToken) => Task.CompletedTask;
+ CancellationToken cancellationToken) => ValueTask.CompletedTask;
///
- protected override Task ApplyDeploymentImpl(
+ protected override ValueTask ApplyDeploymentImpl(
CompileJob compileJob,
- CancellationToken cancellationToken) => Task.CompletedTask;
+ CancellationToken cancellationToken) => ValueTask.CompletedTask;
///
- protected override Task StageDeploymentImpl(CompileJob compileJob, CancellationToken cancellationToken) => Task.CompletedTask;
+ protected override ValueTask StageDeploymentImpl(CompileJob compileJob, CancellationToken cancellationToken) => ValueTask.CompletedTask;
///
- protected override Task MarkInactiveImpl(CompileJob compileJob, CancellationToken cancellationToken) => Task.CompletedTask;
+ protected override ValueTask MarkInactiveImpl(CompileJob compileJob, CancellationToken cancellationToken) => ValueTask.CompletedTask;
///
- protected override async Task CommentOnTestMergeSource(
+ protected override async ValueTask CommentOnTestMergeSource(
RepositorySettings repositorySettings,
string remoteRepositoryOwner,
string remoteRepositoryName,
diff --git a/src/Tgstation.Server.Host/Components/Deployment/Remote/IRemoteDeploymentManager.cs b/src/Tgstation.Server.Host/Components/Deployment/Remote/IRemoteDeploymentManager.cs
index ffa64bc878..42b154ac7e 100644
--- a/src/Tgstation.Server.Host/Components/Deployment/Remote/IRemoteDeploymentManager.cs
+++ b/src/Tgstation.Server.Host/Components/Deployment/Remote/IRemoteDeploymentManager.cs
@@ -19,8 +19,8 @@ namespace Tgstation.Server.Host.Components.Deployment.Remote
/// The of the repository being deployed.
/// The active .
/// The for the operation.
- /// A representing the running operation.
- Task StartDeployment(
+ /// A representing the running operation.
+ ValueTask StartDeployment(
Api.Models.Internal.IGitRemoteInformation remoteInformation,
CompileJob compileJob,
CancellationToken cancellationToken);
@@ -31,8 +31,8 @@ namespace Tgstation.Server.Host.Components.Deployment.Remote
/// The staged .
/// An optional to be called when the becomes active or is discarded with or respectively.
/// The for the operation.
- /// A representing the running operation.
- Task StageDeployment(
+ /// A representing the running operation.
+ ValueTask StageDeployment(
CompileJob compileJob,
Action activationCallback,
CancellationToken cancellationToken);
@@ -42,8 +42,8 @@ namespace Tgstation.Server.Host.Components.Deployment.Remote
///
/// The being applied.
/// The for the operation.
- /// A representing the running operation.
- Task ApplyDeployment(CompileJob compileJob, CancellationToken cancellationToken);
+ /// A representing the running operation.
+ ValueTask ApplyDeployment(CompileJob compileJob, CancellationToken cancellationToken);
///
/// Fail a deployment for a given .
@@ -51,8 +51,8 @@ namespace Tgstation.Server.Host.Components.Deployment.Remote
/// The failed .
/// The error message.
/// The for the operation.
- /// A representing the running operation.
- Task FailDeployment(CompileJob compileJob, string errorMessage, CancellationToken cancellationToken);
+ /// A representing the running operation.
+ ValueTask FailDeployment(CompileJob compileJob, string errorMessage, CancellationToken cancellationToken);
///
/// Mark the deplotment for a given as inactive.
@@ -60,7 +60,7 @@ namespace Tgstation.Server.Host.Components.Deployment.Remote
/// The inactive .
/// The for the operation.
/// A representing the running operation.
- Task MarkInactive(CompileJob compileJob, CancellationToken cancellationToken);
+ ValueTask MarkInactive(CompileJob compileJob, CancellationToken cancellationToken);
///
/// Post deployment comments to the test merge ticket.
@@ -71,8 +71,8 @@ namespace Tgstation.Server.Host.Components.Deployment.Remote
/// The GitHub repostiory owner.
/// The GitHub repostiory name.
/// The for the operation.
- /// A representing the running operation.
- Task PostDeploymentComments(
+ /// A representing the running operation.
+ ValueTask PostDeploymentComments(
CompileJob compileJob,
RevisionInformation previousRevisionInformation,
RepositorySettings repositorySettings,
@@ -87,8 +87,8 @@ namespace Tgstation.Server.Host.Components.Deployment.Remote
/// The .
/// The current .
/// The for the operation.
- /// A resulting in the of s that should remain the new .
- Task> RemoveMergedTestMerges(
+ /// A resulting in the of s that should remain the new .
+ ValueTask> RemoveMergedTestMerges(
IRepository repository,
RepositorySettings repositorySettings,
RevisionInformation revisionInformation,
diff --git a/src/Tgstation.Server.Host/Components/Deployment/Remote/NoOpRemoteDeploymentManager.cs b/src/Tgstation.Server.Host/Components/Deployment/Remote/NoOpRemoteDeploymentManager.cs
index 0aee4358fd..b8253d412d 100644
--- a/src/Tgstation.Server.Host/Components/Deployment/Remote/NoOpRemoteDeploymentManager.cs
+++ b/src/Tgstation.Server.Host/Components/Deployment/Remote/NoOpRemoteDeploymentManager.cs
@@ -32,31 +32,31 @@ namespace Tgstation.Server.Host.Components.Deployment.Remote
}
///
- public override Task FailDeployment(Models.CompileJob compileJob, string errorMessage, CancellationToken cancellationToken)
+ public override ValueTask FailDeployment(Models.CompileJob compileJob, string errorMessage, CancellationToken cancellationToken)
{
throw new NotImplementedException();
}
///
- public override Task> RemoveMergedTestMerges(IRepository repository, Models.RepositorySettings repositorySettings, Models.RevisionInformation revisionInformation, CancellationToken cancellationToken)
- => Task.FromResult>(Array.Empty());
+ public override ValueTask> RemoveMergedTestMerges(IRepository repository, Models.RepositorySettings repositorySettings, Models.RevisionInformation revisionInformation, CancellationToken cancellationToken)
+ => ValueTask.FromResult>(Array.Empty());
///
- public override Task StartDeployment(IGitRemoteInformation remoteInformation, Models.CompileJob compileJob, CancellationToken cancellationToken)
- => Task.CompletedTask;
+ public override ValueTask StartDeployment(IGitRemoteInformation remoteInformation, Models.CompileJob compileJob, CancellationToken cancellationToken)
+ => ValueTask.CompletedTask;
///
- protected override Task ApplyDeploymentImpl(Models.CompileJob compileJob, CancellationToken cancellationToken) => Task.CompletedTask;
+ protected override ValueTask ApplyDeploymentImpl(Models.CompileJob compileJob, CancellationToken cancellationToken) => ValueTask.CompletedTask;
///
- protected override Task CommentOnTestMergeSource(
+ protected override ValueTask CommentOnTestMergeSource(
Models.RepositorySettings repositorySettings,
string remoteRepositoryOwner,
string remoteRepositoryName,
string comment,
int testMergeNumber,
CancellationToken cancellationToken)
- => Task.CompletedTask;
+ => ValueTask.CompletedTask;
///
protected override string FormatTestMerge(
@@ -69,12 +69,12 @@ namespace Tgstation.Server.Host.Components.Deployment.Remote
=> String.Empty;
///
- protected override Task MarkInactiveImpl(Models.CompileJob compileJob, CancellationToken cancellationToken)
+ protected override ValueTask MarkInactiveImpl(Models.CompileJob compileJob, CancellationToken cancellationToken)
{
throw new NotImplementedException();
}
///
- protected override Task StageDeploymentImpl(Models.CompileJob compileJob, CancellationToken cancellationToken) => Task.CompletedTask;
+ protected override ValueTask StageDeploymentImpl(Models.CompileJob compileJob, CancellationToken cancellationToken) => ValueTask.CompletedTask;
}
}
diff --git a/src/Tgstation.Server.Host/Components/Events/EventConsumer.cs b/src/Tgstation.Server.Host/Components/Events/EventConsumer.cs
index 82f7cdb8d1..81a0d34585 100644
--- a/src/Tgstation.Server.Host/Components/Events/EventConsumer.cs
+++ b/src/Tgstation.Server.Host/Components/Events/EventConsumer.cs
@@ -31,7 +31,7 @@ namespace Tgstation.Server.Host.Components.Events
}
///
- public async Task HandleEvent(EventType eventType, IEnumerable parameters, bool deploymentPipeline, CancellationToken cancellationToken)
+ public async ValueTask HandleEvent(EventType eventType, IEnumerable parameters, bool deploymentPipeline, CancellationToken cancellationToken)
{
ArgumentNullException.ThrowIfNull(parameters);
diff --git a/src/Tgstation.Server.Host/Components/Events/IEventConsumer.cs b/src/Tgstation.Server.Host/Components/Events/IEventConsumer.cs
index ddd31c90e8..7fddbb8950 100644
--- a/src/Tgstation.Server.Host/Components/Events/IEventConsumer.cs
+++ b/src/Tgstation.Server.Host/Components/Events/IEventConsumer.cs
@@ -16,7 +16,7 @@ namespace Tgstation.Server.Host.Components.Events
/// An of parameters for .
/// If this event is part of the deployment pipeline.
/// The for the operation.
- /// A representing the running operation.
- Task HandleEvent(EventType eventType, IEnumerable parameters, bool deploymentPipeline, CancellationToken cancellationToken);
+ /// A representing the running operation.
+ ValueTask HandleEvent(EventType eventType, IEnumerable parameters, bool deploymentPipeline, CancellationToken cancellationToken);
}
}
diff --git a/src/Tgstation.Server.Host/Components/StaticFiles/Configuration.cs b/src/Tgstation.Server.Host/Components/StaticFiles/Configuration.cs
index 087503d68c..067869b539 100644
--- a/src/Tgstation.Server.Host/Components/StaticFiles/Configuration.cs
+++ b/src/Tgstation.Server.Host/Components/StaticFiles/Configuration.cs
@@ -12,6 +12,7 @@ using Microsoft.Extensions.Logging;
using Tgstation.Server.Api.Models;
using Tgstation.Server.Api.Models.Response;
+using Tgstation.Server.Common.Extensions;
using Tgstation.Server.Host.Components.Events;
using Tgstation.Server.Host.Configuration;
using Tgstation.Server.Host.Extensions;
@@ -198,7 +199,7 @@ namespace Tgstation.Server.Host.Components.StaticFiles
}
///
- public async Task CopyDMFilesTo(string dmeFile, string destination, CancellationToken cancellationToken)
+ public async ValueTask CopyDMFilesTo(string dmeFile, string destination, CancellationToken cancellationToken)
{
using (await SemaphoreSlimContext.Lock(semaphore, cancellationToken))
{
@@ -236,7 +237,7 @@ namespace Tgstation.Server.Host.Components.StaticFiles
}
///
- public async Task> ListDirectory(string configurationRelativePath, ISystemIdentity systemIdentity, CancellationToken cancellationToken)
+ public async ValueTask> ListDirectory(string configurationRelativePath, ISystemIdentity systemIdentity, CancellationToken cancellationToken)
{
await EnsureDirectories(cancellationToken);
var path = ValidateConfigRelativePath(configurationRelativePath);
@@ -283,7 +284,7 @@ namespace Tgstation.Server.Host.Components.StaticFiles
}
///
- public async Task Read(string configurationRelativePath, ISystemIdentity systemIdentity, CancellationToken cancellationToken)
+ public async ValueTask Read(string configurationRelativePath, ISystemIdentity systemIdentity, CancellationToken cancellationToken)
{
await EnsureDirectories(cancellationToken);
var path = ValidateConfigRelativePath(configurationRelativePath);
@@ -393,7 +394,7 @@ namespace Tgstation.Server.Host.Components.StaticFiles
}
///
- public async Task SymlinkStaticFilesTo(string destination, CancellationToken cancellationToken)
+ public async ValueTask SymlinkStaticFilesTo(string destination, CancellationToken cancellationToken)
{
async Task> GetIgnoreFiles()
{
@@ -416,7 +417,7 @@ namespace Tgstation.Server.Host.Components.StaticFiles
IReadOnlyList ignoreFiles;
- async Task SymlinkBase(bool files)
+ async ValueTask SymlinkBase(bool files)
{
Task> task;
if (files)
@@ -425,7 +426,7 @@ namespace Tgstation.Server.Host.Components.StaticFiles
task = ioManager.GetDirectories(GameStaticFilesSubdirectory, cancellationToken);
var entries = await task;
- await Task.WhenAll(entries.Select(async file =>
+ await ValueTaskExtensions.WhenAll(entries.Select(async file =>
{
var fileName = ioManager.GetFileName(file);
@@ -458,12 +459,12 @@ namespace Tgstation.Server.Host.Components.StaticFiles
{
await EnsureDirectories(cancellationToken);
ignoreFiles = await GetIgnoreFiles();
- await Task.WhenAll(SymlinkBase(true), SymlinkBase(false));
+ await ValueTaskExtensions.WhenAll(SymlinkBase(true), SymlinkBase(false));
}
}
///
- public async Task Write(string configurationRelativePath, ISystemIdentity systemIdentity, string previousHash, CancellationToken cancellationToken)
+ public async ValueTask Write(string configurationRelativePath, ISystemIdentity systemIdentity, string previousHash, CancellationToken cancellationToken)
{
await EnsureDirectories(cancellationToken);
var path = ValidateConfigRelativePath(configurationRelativePath);
@@ -573,7 +574,7 @@ namespace Tgstation.Server.Host.Components.StaticFiles
}
///
- public async Task CreateDirectory(string configurationRelativePath, ISystemIdentity systemIdentity, CancellationToken cancellationToken)
+ public async ValueTask CreateDirectory(string configurationRelativePath, ISystemIdentity systemIdentity, CancellationToken cancellationToken)
{
await EnsureDirectories(cancellationToken);
var path = ValidateConfigRelativePath(configurationRelativePath);
@@ -605,7 +606,7 @@ namespace Tgstation.Server.Host.Components.StaticFiles
public Task StopAsync(CancellationToken cancellationToken) => EnsureDirectories(cancellationToken);
///
- public async Task HandleEvent(EventType eventType, IEnumerable parameters, bool deploymentPipeline, CancellationToken cancellationToken)
+ public async ValueTask HandleEvent(EventType eventType, IEnumerable parameters, bool deploymentPipeline, CancellationToken cancellationToken)
{
ArgumentNullException.ThrowIfNull(parameters);
@@ -668,7 +669,7 @@ namespace Tgstation.Server.Host.Components.StaticFiles
}
///
- public async Task DeleteDirectory(string configurationRelativePath, ISystemIdentity systemIdentity, CancellationToken cancellationToken)
+ public async ValueTask DeleteDirectory(string configurationRelativePath, ISystemIdentity systemIdentity, CancellationToken cancellationToken)
{
await EnsureDirectories(cancellationToken);
var path = ValidateConfigRelativePath(configurationRelativePath);
diff --git a/src/Tgstation.Server.Host/Components/StaticFiles/IConfiguration.cs b/src/Tgstation.Server.Host/Components/StaticFiles/IConfiguration.cs
index b4ed9f59f9..59546a044e 100644
--- a/src/Tgstation.Server.Host/Components/StaticFiles/IConfiguration.cs
+++ b/src/Tgstation.Server.Host/Components/StaticFiles/IConfiguration.cs
@@ -21,16 +21,16 @@ namespace Tgstation.Server.Host.Components.StaticFiles
/// The .dme file being compiled.
/// Path to the destination folder.
/// The for the operation.
- /// A resulting in the if any.
- Task CopyDMFilesTo(string dmeFile, string destination, CancellationToken cancellationToken);
+ /// A resulting in the if any.
+ ValueTask CopyDMFilesTo(string dmeFile, string destination, CancellationToken cancellationToken);
///
/// Symlinks all directories in the GameData directory to .
///
/// Path to the destination folder.
/// The for the operation.
- /// A representing the running operation.
- Task SymlinkStaticFilesTo(string destination, CancellationToken cancellationToken);
+ /// A representing the running operation.
+ ValueTask SymlinkStaticFilesTo(string destination, CancellationToken cancellationToken);
///
/// Get s for all items in a given .
@@ -38,8 +38,8 @@ namespace Tgstation.Server.Host.Components.StaticFiles
/// The relative path in the Configuration directory.
/// The for the operation. If , the operation will be performed as the user of the .
/// The for the operation.
- /// A resulting in an of the s for the items in the directory. and will both be . will be returned if the operation failed due to access contention.
- Task> ListDirectory(string configurationRelativePath, ISystemIdentity systemIdentity, CancellationToken cancellationToken);
+ /// A resulting in an of the s for the items in the directory. and will both be . will be returned if the operation failed due to access contention.
+ ValueTask> ListDirectory(string configurationRelativePath, ISystemIdentity systemIdentity, CancellationToken cancellationToken);
///
/// Reads a given .
@@ -47,8 +47,8 @@ namespace Tgstation.Server.Host.Components.StaticFiles
/// The relative path in the Configuration directory.
/// The for the operation. If , the operation will be performed as the user of the .
/// The for the operation.
- /// A resulting in the of the file. will be returned if the operation failed due to access contention.
- Task Read(string configurationRelativePath, ISystemIdentity systemIdentity, CancellationToken cancellationToken);
+ /// A resulting in the of the file. will be returned if the operation failed due to access contention.
+ ValueTask Read(string configurationRelativePath, ISystemIdentity systemIdentity, CancellationToken cancellationToken);
///
/// Create an empty directory at .
@@ -56,8 +56,8 @@ namespace Tgstation.Server.Host.Components.StaticFiles
/// The relative path in the Configuration directory.
/// The for the operation. If , the operation will be performed as the user of the .
/// The for the operation. Usage may result in partial writes.
- /// A resulting in if the directory already existed, otherwise. will be returned if the operation failed due to access contention.
- Task CreateDirectory(string configurationRelativePath, ISystemIdentity systemIdentity, CancellationToken cancellationToken);
+ /// A resulting in if the directory already existed, otherwise. will be returned if the operation failed due to access contention.
+ ValueTask CreateDirectory(string configurationRelativePath, ISystemIdentity systemIdentity, CancellationToken cancellationToken);
///
/// Attempt to delete an empty directory at .
@@ -65,8 +65,8 @@ namespace Tgstation.Server.Host.Components.StaticFiles
/// The path of the empty directory to delete.
/// The for the operation. If , the operation will be performed as the user of the .
/// The for the operation.
- /// if the directory was empty and deleted, otherwise. will be returned if the operation failed due to access contention.
- Task DeleteDirectory(string configurationRelativePath, ISystemIdentity systemIdentity, CancellationToken cancellationToken);
+ /// A resulting in if the directory was empty and deleted, otherwise. will be returned if the operation failed due to access contention.
+ ValueTask DeleteDirectory(string configurationRelativePath, ISystemIdentity systemIdentity, CancellationToken cancellationToken);
///
/// Writes to a given .
@@ -75,7 +75,7 @@ namespace Tgstation.Server.Host.Components.StaticFiles
/// The for the operation. If , the operation will be performed as the user of the .
/// The hash any existing file must match in order for the write to succeed.
/// The for the operation. Usage may result in partial writes.
- /// A resulting in the updated and associated writing . will be returned if the operation failed due to access contention.
- Task Write(string configurationRelativePath, ISystemIdentity systemIdentity, string previousHash, CancellationToken cancellationToken);
+ /// A resulting in the updated and associated writing . will be returned if the operation failed due to access contention.
+ ValueTask Write(string configurationRelativePath, ISystemIdentity systemIdentity, string previousHash, CancellationToken cancellationToken);
}
}
diff --git a/src/Tgstation.Server.Host/Components/Watchdog/BasicWatchdog.cs b/src/Tgstation.Server.Host/Components/Watchdog/BasicWatchdog.cs
index 4bbb5956e6..a8e574c6c4 100644
--- a/src/Tgstation.Server.Host/Components/Watchdog/BasicWatchdog.cs
+++ b/src/Tgstation.Server.Host/Components/Watchdog/BasicWatchdog.cs
@@ -202,8 +202,8 @@ namespace Tgstation.Server.Host.Components.Watchdog
protected sealed override ISessionController GetActiveController() => Server;
///
- protected override async Task InitController(
- Task eventTask,
+ protected override async ValueTask InitController(
+ ValueTask eventTask,
ReattachInformation reattachInfo,
CancellationToken cancellationToken)
{
diff --git a/src/Tgstation.Server.Host/Components/Watchdog/WatchdogBase.cs b/src/Tgstation.Server.Host/Components/Watchdog/WatchdogBase.cs
index 4fc762046a..1f3190d1c4 100644
--- a/src/Tgstation.Server.Host/Components/Watchdog/WatchdogBase.cs
+++ b/src/Tgstation.Server.Host/Components/Watchdog/WatchdogBase.cs
@@ -13,6 +13,7 @@ using Serilog.Context;
using Tgstation.Server.Api.Models;
using Tgstation.Server.Api.Models.Internal;
using Tgstation.Server.Api.Rights;
+using Tgstation.Server.Common.Extensions;
using Tgstation.Server.Host.Components.Chat;
using Tgstation.Server.Host.Components.Deployment;
using Tgstation.Server.Host.Components.Deployment.Remote;
@@ -452,7 +453,7 @@ namespace Tgstation.Server.Host.Components.Watchdog
}
///
- async Task IEventConsumer.HandleEvent(EventType eventType, IEnumerable parameters, bool deploymentPipeline, CancellationToken cancellationToken)
+ async ValueTask IEventConsumer.HandleEvent(EventType eventType, IEnumerable parameters, bool deploymentPipeline, CancellationToken cancellationToken)
{
ArgumentNullException.ThrowIfNull(parameters);
@@ -478,7 +479,7 @@ namespace Tgstation.Server.Host.Components.Watchdog
/// to use, if any.
/// The for the operation.
/// A representing the running operation.
- protected abstract Task InitController(Task eventTask, ReattachInformation reattachInfo, CancellationToken cancellationToken);
+ protected abstract ValueTask InitController(ValueTask eventTask, ReattachInformation reattachInfo, CancellationToken cancellationToken);
///
/// Launches the watchdog.
@@ -488,8 +489,8 @@ namespace Tgstation.Server.Host.Components.Watchdog
/// If launch failure should be announced to chat by this function.
/// to use, if any.
/// The for the operation.
- /// A representing the running operation.
- protected async Task LaunchNoLock(
+ /// A representing the running operation.
+ protected async ValueTask LaunchNoLock(
bool startMonitor,
bool announce,
bool announceFailure,
@@ -504,7 +505,7 @@ namespace Tgstation.Server.Host.Components.Watchdog
throw new JobException(ErrorCode.WatchdogCompileJobCorrupted);
// this is necessary, the monitor could be in it's sleep loop trying to restart, if so cancel THAT monitor and start our own with blackjack and hookers
- var eventTask = Task.CompletedTask;
+ var eventTask = ValueTask.CompletedTask;
if (announce)
{
Chat.QueueWatchdogMessage(
@@ -532,7 +533,7 @@ namespace Tgstation.Server.Host.Components.Watchdog
{
Logger.LogWarning(e, "Failed to start watchdog!");
var originalChatTask = eventTask;
- async Task ChainEventTaskWithErrorMessage()
+ async ValueTask ChainEventTaskWithErrorMessage()
{
await originalChatTask;
if (announceFailure)
@@ -606,11 +607,11 @@ namespace Tgstation.Server.Host.Components.Watchdog
}
///
- /// Call from when a reattach operation fails to attempt a fresh start.
+ /// Call from when a reattach operation fails to attempt a fresh start.
///
/// The for the operation.
/// A representing the running operation.
- protected async Task ReattachFailure(CancellationToken cancellationToken)
+ protected async ValueTask ReattachFailure(CancellationToken cancellationToken)
{
// we lost the server, just restart entirely
// DCT: Operation must always run
@@ -619,7 +620,7 @@ namespace Tgstation.Server.Host.Components.Watchdog
Logger.LogWarning(FailReattachMessage);
Chat.QueueWatchdogMessage(FailReattachMessage);
- await InitController(Task.CompletedTask, null, cancellationToken);
+ await InitController(ValueTask.CompletedTask, null, cancellationToken);
}
///
@@ -696,12 +697,12 @@ namespace Tgstation.Server.Host.Components.Watchdog
/// If the event should be sent to DreamDaemon.
/// The for the operation.
/// A representing the running operation.
- protected async Task HandleEventImpl(EventType eventType, IEnumerable parameters, bool relayToSession, CancellationToken cancellationToken)
+ protected async ValueTask HandleEventImpl(EventType eventType, IEnumerable parameters, bool relayToSession, CancellationToken cancellationToken)
{
try
{
- var sessionEventTask = relayToSession ? ((IEventConsumer)this).HandleEvent(eventType, parameters, false, cancellationToken) : Task.CompletedTask;
- await Task.WhenAll(
+ var sessionEventTask = relayToSession ? ((IEventConsumer)this).HandleEvent(eventType, parameters, false, cancellationToken) : ValueTask.CompletedTask;
+ await ValueTaskExtensions.WhenAll(
eventConsumer.HandleEvent(eventType, parameters, false, cancellationToken),
sessionEventTask);
}
diff --git a/src/Tgstation.Server.Host/Utils/GitHub/GitHubService.cs b/src/Tgstation.Server.Host/Utils/GitHub/GitHubService.cs
index 053510b759..c210cb1b54 100644
--- a/src/Tgstation.Server.Host/Utils/GitHub/GitHubService.cs
+++ b/src/Tgstation.Server.Host/Utils/GitHub/GitHubService.cs
@@ -46,7 +46,7 @@ namespace Tgstation.Server.Host.Utils.GitHub
}
///
- public async Task CreateOAuthAccessToken(OAuthConfiguration oAuthConfiguration, string code, CancellationToken cancellationToken)
+ public async ValueTask CreateOAuthAccessToken(OAuthConfiguration oAuthConfiguration, string code, CancellationToken cancellationToken)
{
ArgumentNullException.ThrowIfNull(oAuthConfiguration);
@@ -71,7 +71,7 @@ namespace Tgstation.Server.Host.Utils.GitHub
}
///
- public async Task> GetTgsReleases(CancellationToken cancellationToken)
+ public async ValueTask> GetTgsReleases(CancellationToken cancellationToken)
{
logger.LogTrace("GetTgsReleases");
var allReleases = await gitHubClient
@@ -116,7 +116,7 @@ namespace Tgstation.Server.Host.Utils.GitHub
}
///
- public async Task GetUpdatesRepositoryUrl(CancellationToken cancellationToken)
+ public async ValueTask GetUpdatesRepositoryUrl(CancellationToken cancellationToken)
{
logger.LogTrace("GetUpdatesRepositoryUrl");
var repository = await gitHubClient
@@ -131,7 +131,7 @@ namespace Tgstation.Server.Host.Utils.GitHub
}
///
- public async Task GetCurrentUserId(CancellationToken cancellationToken)
+ public async ValueTask GetCurrentUserId(CancellationToken cancellationToken)
{
logger.LogTrace("CreateOAuthAccessToken");
@@ -162,7 +162,7 @@ namespace Tgstation.Server.Host.Utils.GitHub
}
///
- public async Task GetRepositoryId(string repoOwner, string repoName, CancellationToken cancellationToken)
+ public async ValueTask GetRepositoryId(string repoOwner, string repoName, CancellationToken cancellationToken)
{
ArgumentNullException.ThrowIfNull(repoOwner);
@@ -181,7 +181,7 @@ namespace Tgstation.Server.Host.Utils.GitHub
}
///
- public async Task CreateDeployment(NewDeployment newDeployment, string repoOwner, string repoName, CancellationToken cancellationToken)
+ public async ValueTask CreateDeployment(NewDeployment newDeployment, string repoOwner, string repoName, CancellationToken cancellationToken)
{
ArgumentNullException.ThrowIfNull(newDeployment);
diff --git a/src/Tgstation.Server.Host/Utils/GitHub/IAuthenticatedGitHubService.cs b/src/Tgstation.Server.Host/Utils/GitHub/IAuthenticatedGitHubService.cs
index f920f25912..619bcead20 100644
--- a/src/Tgstation.Server.Host/Utils/GitHub/IAuthenticatedGitHubService.cs
+++ b/src/Tgstation.Server.Host/Utils/GitHub/IAuthenticatedGitHubService.cs
@@ -28,8 +28,8 @@ namespace Tgstation.Server.Host.Utils.GitHub
/// The owner of the target repository.
/// The name of the target repository.
/// The for the operation.
- /// A resulting in the new deployment's ID.
- Task CreateDeployment(NewDeployment newDeployment, string repoOwner, string repoName, CancellationToken cancellationToken);
+ /// A resulting in the new deployment's ID.
+ ValueTask CreateDeployment(NewDeployment newDeployment, string repoOwner, string repoName, CancellationToken cancellationToken);
///
/// Create a on a target deployment.
diff --git a/src/Tgstation.Server.Host/Utils/GitHub/IGitHubService.cs b/src/Tgstation.Server.Host/Utils/GitHub/IGitHubService.cs
index 1776529dc1..2bc7e9c2d3 100644
--- a/src/Tgstation.Server.Host/Utils/GitHub/IGitHubService.cs
+++ b/src/Tgstation.Server.Host/Utils/GitHub/IGitHubService.cs
@@ -18,16 +18,16 @@ namespace Tgstation.Server.Host.Utils.GitHub
/// Gets the of the repository designated as the updates repository.
///
/// The for the operation.
- /// A resulting in the of the designated updates repository.
- Task GetUpdatesRepositoryUrl(CancellationToken cancellationToken);
+ /// A resulting in the of the designated updates repository.
+ ValueTask GetUpdatesRepositoryUrl(CancellationToken cancellationToken);
///
/// Get all valid TGS s from the configured update source.
///
/// The for the operation.
- /// A resulting in a of TGS s keyed by their .
+ /// A resulting in a of TGS s keyed by their .
/// GitHub has been known to return incomplete results from the API with this call.
- Task> GetTgsReleases(CancellationToken cancellationToken);
+ ValueTask> GetTgsReleases(CancellationToken cancellationToken);
///
/// Attempt to get an OAuth token from a given .
@@ -35,8 +35,8 @@ namespace Tgstation.Server.Host.Utils.GitHub
/// The . Must have , and set.
/// The OAuth response code.
/// The for the operation.
- /// A resulting in a representing the returned OAuth code from GitHub on success, otherwise.
- Task CreateOAuthAccessToken(OAuthConfiguration oAuthConfiguration, string code, CancellationToken cancellationToken);
+ /// A resulting in a representing the returned OAuth code from GitHub on success, otherwise.
+ ValueTask CreateOAuthAccessToken(OAuthConfiguration oAuthConfiguration, string code, CancellationToken cancellationToken);
///
/// Get a target repostiory's ID.
@@ -44,15 +44,15 @@ namespace Tgstation.Server.Host.Utils.GitHub
/// The owner of the target repository.
/// The name of the target repository.
/// The for the operation.
- /// A resulting in the target repository's ID.
- Task GetRepositoryId(string repoOwner, string repoName, CancellationToken cancellationToken);
+ /// A resulting in the target repository's ID.
+ ValueTask GetRepositoryId(string repoOwner, string repoName, CancellationToken cancellationToken);
///
/// Get the current user's ID.
///
/// The for the operation.
- /// A resulting in the current user's ID.
- Task GetCurrentUserId(CancellationToken cancellationToken);
+ /// A resulting in the current user's ID.
+ ValueTask GetCurrentUserId(CancellationToken cancellationToken);
///
/// Get a given .
diff --git a/tests/Tgstation.Server.Tests/Live/DummyGitHubService.cs b/tests/Tgstation.Server.Tests/Live/DummyGitHubService.cs
index 35f62867c9..709b312bbf 100644
--- a/tests/Tgstation.Server.Tests/Live/DummyGitHubService.cs
+++ b/tests/Tgstation.Server.Tests/Live/DummyGitHubService.cs
@@ -77,10 +77,10 @@ namespace Tgstation.Server.Tests.Live
return Task.CompletedTask;
}
- public Task CreateDeployment(NewDeployment newDeployment, string repoOwner, string repoName, CancellationToken cancellationToken)
+ public ValueTask CreateDeployment(NewDeployment newDeployment, string repoOwner, string repoName, CancellationToken cancellationToken)
{
logger.LogTrace("CreateDeployment");
- return Task.FromResult(new Random().Next()); ;
+ return ValueTask.FromResult(new Random().Next()); ;
}
public Task CreateDeploymentStatus(NewDeploymentStatus newDeploymentStatus, string repoOwner, string repoName, int deploymentId, CancellationToken cancellationToken)
@@ -95,28 +95,28 @@ namespace Tgstation.Server.Tests.Live
return Task.CompletedTask;
}
- public Task CreateOAuthAccessToken(OAuthConfiguration oAuthConfiguration, string code, CancellationToken cancellationToken)
+ public ValueTask CreateOAuthAccessToken(OAuthConfiguration oAuthConfiguration, string code, CancellationToken cancellationToken)
{
logger.LogTrace("CreateOAuthAccessToken");
- return Task.FromResult(cryptographySuite.GetSecureString());
+ return ValueTask.FromResult(cryptographySuite.GetSecureString());
}
- public Task GetCurrentUserId(CancellationToken cancellationToken)
+ public ValueTask GetCurrentUserId(CancellationToken cancellationToken)
{
logger.LogTrace("GetCurrentUserId");
- return Task.FromResult(new Random().Next());
+ return ValueTask.FromResult(new Random().Next());
}
- public Task GetRepositoryId(string repoOwner, string repoName, CancellationToken cancellationToken)
+ public ValueTask GetRepositoryId(string repoOwner, string repoName, CancellationToken cancellationToken)
{
logger.LogTrace("GetRepositoryId");
- return Task.FromResult(new Random().NextInt64());
+ return ValueTask.FromResult(new Random().NextInt64());
}
- public Task GetUpdatesRepositoryUrl(CancellationToken cancellationToken)
+ public ValueTask GetUpdatesRepositoryUrl(CancellationToken cancellationToken)
{
logger.LogTrace("GetUpdatesRepositoryUrl");
- return Task.FromResult(new Uri("https://github.com/tgstation/tgstation-server"));
+ return ValueTask.FromResult(new Uri("https://github.com/tgstation/tgstation-server"));
}
public Task GetPullRequest(string repoOwner, string repoName, int pullRequestNumber, CancellationToken cancellationToken)
@@ -125,10 +125,10 @@ namespace Tgstation.Server.Tests.Live
return Task.FromResult(testPr);
}
- public Task> GetTgsReleases(CancellationToken cancellationToken)
+ public ValueTask> GetTgsReleases(CancellationToken cancellationToken)
{
logger.LogTrace("GetTgsReleases");
- return Task.FromResult(releasesDictionary);
+ return ValueTask.FromResult(releasesDictionary);
}
}
}