diff options
author | vnugent <public@vaughnnugent.com> | 2023-01-27 21:13:16 -0500 |
---|---|---|
committer | vnugent <public@vaughnnugent.com> | 2023-01-27 21:13:16 -0500 |
commit | 892bbaaa5c1f62631070cc74820f349c4c80f55d (patch) | |
tree | c04dfa8c5a3ead1522502635d4bc9696102d28dc /plugins/CacheBroker/src/Endpoints | |
parent | 0ea612dde50e82d722b0654e0e569fd4e7469978 (diff) |
Object cache overhaul and logger updates
Diffstat (limited to 'plugins/CacheBroker/src/Endpoints')
-rw-r--r-- | plugins/CacheBroker/src/Endpoints/BrokerRegistrationEndpoint.cs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/plugins/CacheBroker/src/Endpoints/BrokerRegistrationEndpoint.cs b/plugins/CacheBroker/src/Endpoints/BrokerRegistrationEndpoint.cs index c2e0b84..8f983ac 100644 --- a/plugins/CacheBroker/src/Endpoints/BrokerRegistrationEndpoint.cs +++ b/plugins/CacheBroker/src/Endpoints/BrokerRegistrationEndpoint.cs @@ -56,11 +56,12 @@ using VNLib.Net.Rest.Client; namespace VNLib.Plugins.Cache.Broker.Endpoints { [ConfigurationName("broker_endpoint")] - public sealed class BrokerRegistrationEndpoint : ResourceEndpointBase + public sealed class BrokerRegistrationEndpoint : ResourceEndpointBase, IDisposable { const string HEARTBEAT_PATH = "/heartbeat"; - private static readonly RestClientPool ClientPool = new(10,new RestClientOptions() + //Client pool is instance based and may be disposed when the plugin is unloaded + private readonly RestClientPool ClientPool = new(10,new RestClientOptions() { Encoding = Encoding.UTF8, FollowRedirects = false, @@ -69,6 +70,7 @@ namespace VNLib.Plugins.Cache.Broker.Endpoints }, null); + //Matches the json schema set by the FBM caching extensions library private class ActiveServer { [JsonIgnore] @@ -408,5 +410,12 @@ namespace VNLib.Plugins.Cache.Broker.Endpoints _ = ActiveServers.Remove(server.ServerId!); } } + + + void IDisposable.Dispose() + { + //Cleanup client pool when exiting + ClientPool.Dispose(); + } } } |