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

Support Thread Safety #11

Open
iszak opened this issue Feb 27, 2019 · 1 comment
Open

Support Thread Safety #11

iszak opened this issue Feb 27, 2019 · 1 comment

Comments

@iszak
Copy link

iszak commented Feb 27, 2019

Currently it appears go-operational is not thread safe, in particular the Status struct. Example https://github.com/utilitywarehouse/go-operational/blob/master/op/opstatus.go#L47-L50 I think we should clarify that it's not thread safe (although this is usually assumed the default) or add support for it. Additional work would need to be done around handlers to ensure they assume that e.g. checks could be registered at any time.

My use case for adding support is it will allow starting a process which spawns multiple go routines in parallel where they have a need to register a status check. e.g. gRPC service, message consumer and ops server as separate go routines. This should improve start up time.

The downside of adding locking is a performance penalty.

@mjgarton
Copy link
Contributor

Consider an application with two checks, which are added as each of two parts of the application start up concurrently.

What do you expect the health check to return when one but not the other check has been added?

It's possible one part gets blocked and so never adds the check. To me, until both parts have started, it can't be considered healthy.

How do you propose to ensure the application is "unhealthy" until all of the expected parts have added their checks and are healthy?

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

No branches or pull requests

2 participants