diff options
author | TheArcaneBrony <myrainbowdash949@gmail.com> | 2023-06-26 02:43:54 +0200 |
---|---|---|
committer | TheArcaneBrony <myrainbowdash949@gmail.com> | 2023-06-27 17:43:00 +0200 |
commit | 3ed00f732a284b5a3e96e52d4e3a71869135869b (patch) | |
tree | 308cdd5c9891a676dc55cbf0e0e998ab5a74b2d2 /MatrixRoomUtils.Core/Interfaces | |
parent | Working state, refactored Rory&::LibMatrix (diff) | |
download | MatrixUtils-3ed00f732a284b5a3e96e52d4e3a71869135869b.tar.xz |
Dependency injection stuff
Diffstat (limited to 'MatrixRoomUtils.Core/Interfaces')
-rw-r--r-- | MatrixRoomUtils.Core/Interfaces/IHomeServer.cs | 20 |
1 files changed, 0 insertions, 20 deletions
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<string> _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; } |