aboutsummaryrefslogtreecommitdiff
path: root/plugins/CacheBroker/src/Endpoints/BrokerRegistrationEndpoint.cs
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/CacheBroker/src/Endpoints/BrokerRegistrationEndpoint.cs')
-rw-r--r--plugins/CacheBroker/src/Endpoints/BrokerRegistrationEndpoint.cs13
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();
+ }
}
}