Skip to content

Commit 4fbaac4

Browse files
committed
Fix EnsureAuthenticatedAsync
1 parent 53c6c02 commit 4fbaac4

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

LXGaming.FloodAnalytics/Services/Flood/FloodService.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ public Task StopAsync(CancellationToken cancellationToken) {
9191
return Task.CompletedTask;
9292
}
9393

94-
public async Task<T> EnsureAuthenticatedAsync<T>(Task<T> task) {
94+
public async Task<T> EnsureAuthenticatedAsync<T>(Func<Task<T>> task) {
9595
try {
96-
return await task;
96+
return await task();
9797
} catch (HttpRequestException ex) {
9898
if (ex is not { StatusCode: HttpStatusCode.Unauthorized }) {
9999
throw;
@@ -107,7 +107,7 @@ public async Task<T> EnsureAuthenticatedAsync<T>(Task<T> task) {
107107
_logger.LogWarning("Reconnection failed!");
108108
}
109109

110-
return await task;
110+
return await task();
111111
}
112112

113113
public async Task<Authenticate?> AuthenticateAsync(string username, string password) {

LXGaming.FloodAnalytics/Services/Flood/Jobs/FloodJob.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public FloodJob(FloodService floodService, InfluxDbService influxDbService) {
1919
}
2020

2121
public async Task Execute(IJobExecutionContext context) {
22-
var torrentListSummary = await _floodService.EnsureAuthenticatedAsync(_floodService.GetTorrentsAsync());
22+
var torrentListSummary = await _floodService.EnsureAuthenticatedAsync(_floodService.GetTorrentsAsync);
2323
if (torrentListSummary?.Torrents == null || torrentListSummary.Torrents.Count == 0) {
2424
return;
2525
}

0 commit comments

Comments
 (0)