-
Notifications
You must be signed in to change notification settings - Fork 50
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
Speed up on go1.15 v2 #59
Conversation
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.
Thanks for your PR. This one looks good to me (I left a few comments though).
mocks/service_mock.go
Outdated
@@ -38,10 +38,16 @@ func (m *ServiceMock) StartServer() error { | |||
return nil | |||
} | |||
|
|||
// Not used: backward compatibility with public interface | |||
func (m *ServiceMock) ShutdownServer() { |
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.
This is not a library-wide public method, so feel free to change its signature. Simply expand it with Context argument.
mocks/mocks.go
Outdated
func (m *Mocks) Shutdown() { | ||
_ = m.ShutdownContext(context.TODO()) |
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 guess here we should pre-cancel the context to defeat the slowing down issue.
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 planned to switch my tests to context-related method, and do it in my code, but ok, lets leave "old" behaviour here.
mocks/service_mock.go
Outdated
_ = m.ShutdownServerContext(context.TODO()) | ||
} | ||
|
||
func (m *ServiceMock) ShutdownServerContext(ctx context.Context) (err 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.
Let's use unnamed return value, just like in all other methods around. Just to keep the coding style unified.
The same as #58, but with different methods to shutdown, which accepts context from outside