Skip to content

Commit 35fc6bf

Browse files
committed
Log notifications for version increment/advancement
1 parent f2abc72 commit 35fc6bf

2 files changed

Lines changed: 18 additions & 3 deletions

File tree

src/Server/Controllers/Api/v1/Admin/VersioningController.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ namespace Ryujinx.Systems.Update.Server.Controllers.Admin;
99
[ApiController]
1010
public class VersioningController : Controller
1111
{
12+
private readonly ILogger<VersioningController> _logger;
13+
14+
public VersioningController(ILogger<VersioningController> logger)
15+
{
16+
_logger = logger;
17+
}
18+
1219
[HttpGet(Constants.RouteName_Api_Versioning_GetNextVersion)]
1320
public async Task<ActionResult<string>> GetNext([FromQuery] string rc)
1421
{
@@ -53,7 +60,9 @@ public async Task<ActionResult> Increment([FromQuery] string rc)
5360
return Problem("This instance of Ryubing UpdateServer is not configured to support this endpoint.",
5461
statusCode: 418);
5562

56-
versionProviderService.IncrementBuild(releaseChannel);
63+
var newVersion = versionProviderService.IncrementBuild(releaseChannel);
64+
65+
_logger.LogInformation("{channel} incremented to: {newVersion}", releaseChannel, newVersion);
5766

5867
return Ok();
5968
}
@@ -81,6 +90,8 @@ public async Task<ActionResult> Advance()
8190

8291
versionProviderService.Advance();
8392

93+
_logger.LogInformation("Advanced major version to 1.{major}.", versionProviderService.CurrentMajor);
94+
8495
return Ok();
8596
}
8697
}

src/Server/Services/VersionProviderService.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ public VersionProviderService(ILogger<VersionProviderService> logger)
2020
}
2121
}
2222

23+
public ulong CurrentMajor => _data.Stable.Major;
24+
2325
public string GetCurrentVersion(ReleaseChannel rc) =>
2426
rc switch
2527
{
@@ -36,16 +38,18 @@ public string GetNextVersion(ReleaseChannel rc) =>
3638
_ => throw new ArgumentOutOfRangeException()
3739
};
3840

39-
public void IncrementBuild(ReleaseChannel rc)
41+
public VersionProvider.Entry IncrementBuild(ReleaseChannel rc)
4042
{
41-
_ = rc switch
43+
var entry = rc switch
4244
{
4345
ReleaseChannel.Stable => _data.Stable = _data.Stable.CopyIncrement(),
4446
ReleaseChannel.Canary => _data.Canary = _data.Canary.CopyIncrement(),
4547
_ => throw new ArgumentOutOfRangeException()
4648
};
4749

4850
_data.Save();
51+
52+
return entry;
4953
}
5054

5155
public void Advance()

0 commit comments

Comments
 (0)