mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-29 08:00:19 +01:00
Sanitize your public API functions
This commit is contained in:
@@ -119,6 +119,14 @@ namespace Tgstation.Server.Host.Components
|
||||
/// <inheritdoc />
|
||||
public async Task CompileProcess(Job job, IServiceProvider serviceProvider, Action<int> progressReporter, CancellationToken cancellationToken)
|
||||
{
|
||||
//DO NOT FOLLOW THE SUGGESTION FOR A THROW EXPRESSION HERE
|
||||
if (job == null)
|
||||
throw new ArgumentNullException(nameof(job));
|
||||
if (serviceProvider == null)
|
||||
throw new ArgumentNullException(nameof(serviceProvider));
|
||||
if (progressReporter == null)
|
||||
throw new ArgumentNullException(nameof(progressReporter));
|
||||
|
||||
var databaseContext = serviceProvider.GetRequiredService<IDatabaseContext>();
|
||||
|
||||
var ddSettingsTask = databaseContext.DreamDaemonSettings.Where(x => x.InstanceId == metadata.Id).Select(x => new DreamDaemonSettings
|
||||
|
||||
@@ -247,6 +247,8 @@ namespace Tgstation.Server.Host.Core
|
||||
/// <inheritdoc />
|
||||
public int? JobProgress(Job job)
|
||||
{
|
||||
if (job == null)
|
||||
throw new ArgumentNullException(nameof(job));
|
||||
lock (this)
|
||||
{
|
||||
if (!jobs.TryGetValue(job.Id, out var handler))
|
||||
@@ -258,6 +260,10 @@ namespace Tgstation.Server.Host.Core
|
||||
/// <inheritdoc />
|
||||
public async Task WaitForJobCompletion(Job job, User canceller, CancellationToken jobCancellationToken, CancellationToken cancellationToken)
|
||||
{
|
||||
if (job == null)
|
||||
throw new ArgumentNullException(nameof(job));
|
||||
if (canceller == null)
|
||||
throw new ArgumentNullException(nameof(canceller));
|
||||
JobHandler handler;
|
||||
lock (this)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user