Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugins: support Close() for Tracer plugins as well #6672

Merged
merged 1 commit into from
Sep 24, 2019

Conversation

MichaelMure
Copy link
Contributor

Most of the tracers available need to properly close to send the remaining traces before the process exit.

@MichaelMure
Copy link
Contributor Author

CI failure is unrelated.

Copy link
Member

@Stebalien Stebalien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor comments but overall I'm in favor of this change.

plugin/tracer.go Outdated
@@ -6,6 +6,7 @@ import (

// PluginTracer is an interface that can be implemented to add a tracer
type PluginTracer interface {
Plugin
Closer
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't force tracers to have a close method.

@@ -266,7 +266,7 @@ func (loader *PluginLoader) Close() error {
started := loader.started
loader.started = nil
for _, pl := range started {
if pl, ok := pl.(plugin.PluginDaemon); ok {
if pl, ok := pl.(plugin.Closer); ok {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

plugin.Closer feels a bit overkill. What about just type-asserting pl.(io.Closer)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm ok with that if you are, I just though the semantic was a bit off (it's not really an I/O).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

io.Closer is really just the standard "closer" at this point.

Most of the tracers available need to properly close to send
the remaining traces before the process exit.
@MichaelMure
Copy link
Contributor Author

Fixed as your were suggesting.

Copy link
Member

@Stebalien Stebalien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Stebalien Stebalien merged commit 3453f0e into ipfs:master Sep 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants