Skip to content

Instantly share code, notes, and snippets.

@ncdc
Created May 11, 2018 14:37
Show Gist options
  • Save ncdc/c502eae499d63b0b1e445e8545d9b9f8 to your computer and use it in GitHub Desktop.
Save ncdc/c502eae499d63b0b1e445e8545d9b9f8 to your computer and use it in GitHub Desktop.
diff --git a/pkg/cmd/server/server.go b/pkg/cmd/server/server.go
index 779df46..1ba4d96 100644
--- a/pkg/cmd/server/server.go
+++ b/pkg/cmd/server/server.go
@@ -224,6 +224,8 @@ func newServer(namespace, baseName, pluginDir string, logger *logrus.Logger) (*s
}
func (s *server) run() error {
+ defer s.pluginManager.CleanupClients()
+
if err := s.ensureArkNamespace(); err != nil {
return err
}
diff --git a/pkg/plugin/manager.go b/pkg/plugin/manager.go
index 3136bb9..2579288 100644
--- a/pkg/plugin/manager.go
+++ b/pkg/plugin/manager.go
@@ -44,6 +44,7 @@ func baseConfig() *plugin.ClientConfig {
return &plugin.ClientConfig{
HandshakeConfig: Handshake,
AllowedProtocols: []plugin.Protocol{plugin.ProtocolGRPC},
+ Managed: true,
}
}
@@ -123,6 +124,8 @@ type Manager interface {
// CloseRestoreItemActions terminates the plugin sub-processes that
// are hosting RestoreItemAction plugins for the given restore name.
CloseRestoreItemActions(restoreName string) error
+
+ CleanupClients()
}
type manager struct {
@@ -150,6 +153,10 @@ func NewManager(logger logrus.FieldLogger, level logrus.Level, pluginDir string)
return m, nil
}
+func (m *manager) CleanupClients() {
+ plugin.CleanupClients()
+}
+
func pluginForKind(kind PluginKind) plugin.Plugin {
switch kind {
case PluginKindObjectStore:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment