Skip to content

Commit

Permalink
add a default value for GetLatestRelease cancellation token
Browse files Browse the repository at this point in the history
  • Loading branch information
hahn-kev committed Dec 9, 2024
1 parent 05fbec0 commit da8ba2c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions backend/LexBoxApi/Controllers/FwLiteReleaseController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class FwLiteReleaseController(FwLiteReleaseService releaseService) : Cont
public async Task<ActionResult> DownloadLatest()
{
using var activity = LexBoxActivitySource.Get().StartActivity();
var latestRelease = await releaseService.GetLatestRelease(default);
var latestRelease = await releaseService.GetLatestRelease();
if (latestRelease is null)
{
activity?.SetStatus(ActivityStatusCode.Error, "Latest release not found");
Expand All @@ -41,7 +41,7 @@ public async ValueTask<ActionResult<FwLiteRelease>> LatestRelease(string? appVer
{
using var activity = LexBoxActivitySource.Get().StartActivity();
activity?.AddTag(FwLiteReleaseService.FwLiteClientVersionTag, appVersion ?? "unknown");
var latestRelease = await releaseService.GetLatestRelease(default);
var latestRelease = await releaseService.GetLatestRelease();
activity?.AddTag(FwLiteReleaseService.FwLiteReleaseVersionTag, latestRelease?.Version);
if (latestRelease is null) return NotFound();
return latestRelease;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class FwLiteReleaseService(IHttpClientFactory factory, HybridCache cache)
public const string FwLiteClientVersionTag = "app.fw-lite.client.version";
public const string FwLiteReleaseVersionTag = "app.fw-lite.release.version";

public async ValueTask<FwLiteRelease?> GetLatestRelease(CancellationToken token)
public async ValueTask<FwLiteRelease?> GetLatestRelease(CancellationToken token = default)
{
return await cache.GetOrCreateAsync(GithubLatestRelease,
FetchLatestReleaseFromGithub,
Expand All @@ -22,7 +22,7 @@ public class FwLiteReleaseService(IHttpClientFactory factory, HybridCache cache)

public async ValueTask<ShouldUpdateResponse> ShouldUpdate(string appVersion)
{
var latestRelease = await GetLatestRelease(default);
var latestRelease = await GetLatestRelease();
if (latestRelease is null) return new ShouldUpdateResponse(null);

var shouldUpdateToRelease = ShouldUpdateToRelease(appVersion, latestRelease.Version);
Expand Down

0 comments on commit da8ba2c

Please sign in to comment.