about summary refs log tree commit diff
path: root/LibMatrix/Services/HomeserverProviderService.cs
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2024-07-29 22:44:44 +0200
committerRory& <root@rory.gay>2024-07-29 22:44:44 +0200
commitd04269ea2bc944099d95a32aada7bcd4639969b2 (patch)
treee6998317638be351cc1f83333c87f562004c1652 /LibMatrix/Services/HomeserverProviderService.cs
parentDrop example bots (diff)
downloadLibMatrix-d04269ea2bc944099d95a32aada7bcd4639969b2.tar.xz
Some cleanup, fixes
Diffstat (limited to 'LibMatrix/Services/HomeserverProviderService.cs')
-rw-r--r--LibMatrix/Services/HomeserverProviderService.cs6
1 files changed, 4 insertions, 2 deletions
diff --git a/LibMatrix/Services/HomeserverProviderService.cs b/LibMatrix/Services/HomeserverProviderService.cs
index 3e42c21..a674549 100644
--- a/LibMatrix/Services/HomeserverProviderService.cs
+++ b/LibMatrix/Services/HomeserverProviderService.cs
@@ -23,9 +23,11 @@ public class HomeserverProviderService(ILogger<HomeserverProviderService> logger
 
             AuthenticatedHomeserverGeneric? hs = null;
             if (!useGeneric) {
+                var clientVersionsTask = rhs.GetClientVersionsAsync();
+                var serverVersionTask = rhs.FederationClient?.GetServerVersionAsync() ?? Task.FromResult<ServerVersionResponse?>(null)!;
                 ClientVersionsResponse? clientVersions = new();
                 try {
-                    clientVersions = await rhs.GetClientVersionsAsync();
+                    clientVersions = await clientVersionsTask;
                 }
                 catch (Exception e) {
                     logger.LogError(e, "Failed to get client versions for {homeserver}", homeserver);
@@ -33,7 +35,7 @@ public class HomeserverProviderService(ILogger<HomeserverProviderService> logger
 
                 ServerVersionResponse? serverVersion;
                 try {
-                    serverVersion = await (rhs.FederationClient?.GetServerVersionAsync() ?? Task.FromResult<ServerVersionResponse?>(null)!);
+                    serverVersion = await serverVersionTask;
                 }
                 catch (Exception e) {
                     logger.LogWarning(e, "Failed to get server version for {homeserver}", homeserver);