From 3ed00f732a284b5a3e96e52d4e3a71869135869b Mon Sep 17 00:00:00 2001 From: TheArcaneBrony Date: Mon, 26 Jun 2023 02:43:54 +0200 Subject: Dependency injection stuff --- MatrixRoomUtils.Core/Interfaces/IHomeServer.cs | 20 -------------------- 1 file changed, 20 deletions(-) (limited to 'MatrixRoomUtils.Core/Interfaces') diff --git a/MatrixRoomUtils.Core/Interfaces/IHomeServer.cs b/MatrixRoomUtils.Core/Interfaces/IHomeServer.cs index fcff0f2..029530c 100644 --- a/MatrixRoomUtils.Core/Interfaces/IHomeServer.cs +++ b/MatrixRoomUtils.Core/Interfaces/IHomeServer.cs @@ -20,22 +20,6 @@ public class IHomeServer { } private async Task _resolveHomeserverFromWellKnown(string homeserver) { - if (RuntimeCache.HomeserverResolutionCache.Count == 0) { - // Console.WriteLine("No cached homeservers, resolving..."); - await Task.Delay(Random.Shared.Next(1000, 5000)); - } - - if (RuntimeCache.HomeserverResolutionCache.ContainsKey(homeserver)) { - if (RuntimeCache.HomeserverResolutionCache[homeserver].ResolutionTime < DateTime.Now.AddHours(1)) { - Console.WriteLine($"Found cached homeserver: {RuntimeCache.HomeserverResolutionCache[homeserver].Result}"); - return RuntimeCache.HomeserverResolutionCache[homeserver].Result; - } - - Console.WriteLine($"Cached homeserver expired, removing: {RuntimeCache.HomeserverResolutionCache[homeserver].Result}"); - RuntimeCache.HomeserverResolutionCache.Remove(homeserver); - } - //throw new NotImplementedException(); - string result = null; Console.WriteLine($"Resolving homeserver: {homeserver}"); if (!homeserver.StartsWith("http")) homeserver = "https://" + homeserver; @@ -67,10 +51,6 @@ public class IHomeServer { if (result != null) { Console.WriteLine($"Resolved homeserver: {homeserver} -> {result}"); - RuntimeCache.HomeserverResolutionCache.TryAdd(homeserver, new HomeServerResolutionResult { - Result = result, - ResolutionTime = DateTime.Now - }); return result; } -- cgit 1.5.1