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
RevocationDB fixes #866
RevocationDB fixes #866
Conversation
@@ -82,21 +82,23 @@ type ServerConfig struct { | |||
type ServerOptions struct { | |||
Config ServerConfig | |||
Ident *FullIdentity | |||
RevDB *peertls.RevocationDB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks very weird to close "Options".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you have an alternate name or flow in mind?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not at the moment
pkg/provider/identity.go
Outdated
@@ -294,11 +296,14 @@ func (ic IdentityConfig) Run(ctx context.Context, interceptor grpc.UnaryServerIn | |||
if err != nil { | |||
return err | |||
} | |||
defer func() { _ = opts.RevDB.Close() }() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check the error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What should we do with an error in a defer? Or should it not be in a defer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no really nice way of handling them at the moment.
One way would be to use something like:
defer func() { err = utils.CombineErrors(err, opts.RevDB.Close()) }
The other would be to manually close everywhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand how your defer example would do anything useful and I'm pretty sure we want to use a defer for this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Take a look at https://play.golang.org/p/0qh7EuHW7Ut. It relies on the behavior that you can change the returned err
variable.
No description provided.