mirror of
https://github.com/distribution/distribution.git
synced 2025-09-15 22:59:24 +00:00
health: plumb contexts into health checks
Allow health checkers to abort if the request context is canceled. Modify the checkers to respect context cancelation and return wrapped errors so the caller of CheckStatus() would be able to discriminate true failed checks from checks which were aborted because the context became done. Signed-off-by: Cory Snider <csnider@mirantis.com>
This commit is contained in:
@@ -348,7 +348,7 @@ func (app *App) RegisterHealthChecks(healthRegistries ...*health.Registry) {
|
||||
interval = defaultCheckInterval
|
||||
}
|
||||
|
||||
storageDriverCheck := func() error {
|
||||
storageDriverCheck := func(context.Context) error {
|
||||
_, err := app.driver.Stat(app, "/") // "/" should always exist
|
||||
if _, ok := err.(storagedriver.PathNotFoundError); ok {
|
||||
err = nil // pass this through, backend is responding, but this path doesn't exist.
|
||||
|
Reference in New Issue
Block a user