Skip to content

Commit

Permalink
Housekeeping
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin1994 committed Apr 12, 2022
1 parent 9d340b4 commit b2b85a2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Audio frames are transmitted in raw 16 bit integer format with 2 channels. Audio

## Development

Note: Currently OptimeGBA.io depends on a private branch of [OptimeGBA](https://github.com/Powerlated/OptimeGBA) which vends a library rather than an executable.
Note: Currently OptimeGBA.io depends on a [forked branch of OptimeGBA](https://github.com/Martin1994/OptimeGBA/tree/corelib) which vends a library rather than an executable.

Run webpack dev server:

Expand Down
29 changes: 15 additions & 14 deletions server/Services/DaemonService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,25 @@ public async Task StartAsync(CancellationToken cancellationToken)
{
_logger.LogInformation("Starting up daemon...");

_backgroundCancellation = new CancellationTokenSource();
_backgroundTask = Task.Run(async () =>
{
try
{
await RunAsync(_backgroundCancellation.Token);
}
catch (OperationCanceledException) {}
catch (Exception ex)
{
_logger.LogError(ex, ex.Message);
_lifetime.StopApplication();
}
});
_backgroundTask = RunAsyncAndWrapExceptions();

await Task.CompletedTask;
}

private async Task RunAsyncAndWrapExceptions() {
_backgroundCancellation = new CancellationTokenSource();
try
{
await RunAsync(_backgroundCancellation.Token);
}
catch (OperationCanceledException) {}
catch (Exception ex)
{
_logger.LogError(ex, ex.Message);
_lifetime.StopApplication();
}
}

protected abstract Task RunAsync(CancellationToken cancellationToken);

public async Task StopAsync(CancellationToken cancellationToken)
Expand Down

0 comments on commit b2b85a2

Please sign in to comment.