Skip to content

Commit

Permalink
Merge pull request #1990 from tgstation/MinorGraphQLTweaks [GQLDeploy]
Browse files Browse the repository at this point in the history
Make forceFresh argument in UpdateInformation optional
  • Loading branch information
Cyberboss authored Oct 26, 2024
2 parents 0d1261e + 2673b7e commit 2f6f53c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build/Version.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<TgsCoreVersion>6.11.1</TgsCoreVersion>
<TgsConfigVersion>5.3.0</TgsConfigVersion>
<TgsRestVersion>10.10.0</TgsRestVersion>
<TgsGraphQLVersion>0.3.0</TgsGraphQLVersion>
<TgsGraphQLVersion>0.4.0</TgsGraphQLVersion>
<TgsCommonLibraryVersion>7.0.0</TgsCommonLibraryVersion>
<TgsApiLibraryVersion>16.1.0</TgsApiLibraryVersion>
<TgsClientVersion>19.1.0</TgsClientVersion>
Expand Down
11 changes: 6 additions & 5 deletions src/Tgstation.Server.Host/GraphQL/Types/UpdateInformation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public bool UpdateInProgress(
/// <param name="cancellationToken">The <see cref="CancellationToken"/> for the operation.</param>
/// <returns>The <see cref="Uri"/> of the GitHub repository updates are sourced from on success. <see langword="null"/> if a GitHub API error occurred.</returns>
public async ValueTask<Uri?> TrackedRepositoryUrl(
bool forceFresh,
bool? forceFresh,
[Service] IGraphQLAuthorityInvoker<IAdministrationAuthority> administrationAuthority,
CancellationToken cancellationToken)
=> (await GetAdministrationResponseSafe(forceFresh, administrationAuthority, cancellationToken)).TrackedRepositoryUrl;
Expand All @@ -82,7 +82,7 @@ public bool UpdateInProgress(
/// <param name="cancellationToken">The <see cref="CancellationToken"/> for the operation.</param>
/// <returns>The <see cref="Version"/> of the latest TGS version on success. <see langword="null"/> if a GitHub API error occurred.</returns>
public async ValueTask<Version?> LatestVersion(
bool forceFresh,
bool? forceFresh,
[Service] IGraphQLAuthorityInvoker<IAdministrationAuthority> administrationAuthority,
CancellationToken cancellationToken)
=> (await GetAdministrationResponseSafe(forceFresh, administrationAuthority, cancellationToken)).LatestVersion;
Expand All @@ -95,20 +95,21 @@ public bool UpdateInProgress(
/// <param name="cancellationToken">The <see cref="CancellationToken"/> for the operation.</param>
/// <returns>A <see cref="ValueTask{TResult}"/> resulting in the <see cref="AdministrationResponse"/> from the <paramref name="administrationAuthority"/>.</returns>
async ValueTask<AdministrationResponse> GetAdministrationResponseSafe(
bool forceFresh,
bool? forceFresh,
IGraphQLAuthorityInvoker<IAdministrationAuthority> administrationAuthority,
CancellationToken cancellationToken)
{
using (await SemaphoreSlimContext.Lock(cacheReadSemaphore, cancellationToken))
{
forceFresh ??= false;
if (cacheForceGenerated)
forceFresh = false;
else
cacheForceGenerated |= forceFresh;
cacheForceGenerated |= forceFresh.Value;

ArgumentNullException.ThrowIfNull(administrationAuthority);
var response = await administrationAuthority.Invoke<AdministrationResponse, AdministrationResponse>(
authority => authority.GetUpdateInformation(forceFresh, cancellationToken));
authority => authority.GetUpdateInformation(forceFresh.Value, cancellationToken));

return response;
}
Expand Down

0 comments on commit 2f6f53c

Please sign in to comment.