2019-11-30 14:40:22 +00:00
|
|
|
// Copyright 2019 The Gitea Authors. All rights reserved.
|
2022-11-27 18:20:29 +00:00
|
|
|
// SPDX-License-Identifier: MIT
|
2019-11-30 14:40:22 +00:00
|
|
|
|
|
|
|
package graceful
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
)
|
|
|
|
|
|
|
|
// ShutdownContext returns a context.Context that is Done at shutdown
|
|
|
|
// Callers using this context should ensure that they are registered as a running server
|
|
|
|
// in order that they are waited for.
|
2019-12-15 09:51:28 +00:00
|
|
|
func (g *Manager) ShutdownContext() context.Context {
|
2021-05-15 14:22:26 +00:00
|
|
|
return g.shutdownCtx
|
2019-11-30 14:40:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// HammerContext returns a context.Context that is Done at hammer
|
|
|
|
// Callers using this context should ensure that they are registered as a running server
|
|
|
|
// in order that they are waited for.
|
2019-12-15 09:51:28 +00:00
|
|
|
func (g *Manager) HammerContext() context.Context {
|
2021-05-15 14:22:26 +00:00
|
|
|
return g.hammerCtx
|
2019-11-30 14:40:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// TerminateContext returns a context.Context that is Done at terminate
|
|
|
|
// Callers using this context should ensure that they are registered as a terminating server
|
|
|
|
// in order that they are waited for.
|
2019-12-15 09:51:28 +00:00
|
|
|
func (g *Manager) TerminateContext() context.Context {
|
2021-05-15 14:22:26 +00:00
|
|
|
return g.terminateCtx
|
2019-11-30 14:40:22 +00:00
|
|
|
}
|