Refactor backend into domain-first slices

This commit is contained in:
2026-03-19 18:15:44 -04:00
parent 07a3142316
commit 9a5040cf1f
53 changed files with 94 additions and 140 deletions

View File

@@ -0,0 +1,19 @@
namespace SpaceGame.Api.Universe.Simulation;
public sealed class SimulationHostedService(WorldService worldService) : BackgroundService
{
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
using var timer = new PeriodicTimer(TimeSpan.FromMilliseconds(200));
try
{
while (!stoppingToken.IsCancellationRequested && await timer.WaitForNextTickAsync(stoppingToken))
{
worldService.Tick(0.2f);
}
}
catch (OperationCanceledException) when (stoppingToken.IsCancellationRequested)
{
}
}
}