forked from mtusi2026/mtusi2026lab3
оценка 4
This commit is contained in:
@@ -154,6 +154,8 @@ func main() {
|
||||
var rootHandler http.Handler = mux
|
||||
rootHandler = middleware.Recovery(rootHandler)
|
||||
rootHandler = middleware.Logger(rootHandler)
|
||||
availabilityGate := middleware.NewAvailabilityGate()
|
||||
rootHandler = availabilityGate.Middleware(rootHandler)
|
||||
rootHandler = middleware.RequestID(rootHandler)
|
||||
rootHandler = middleware.InstanceID(cfg.InstanceID, rootHandler)
|
||||
|
||||
@@ -196,6 +198,13 @@ func main() {
|
||||
signalValue,
|
||||
)
|
||||
|
||||
availabilityGate.BeginDrain()
|
||||
log.Printf(
|
||||
"[INFO] Readiness disabled; draining new traffic for %s",
|
||||
cfg.ShutdownDrainDelay,
|
||||
)
|
||||
time.Sleep(cfg.ShutdownDrainDelay)
|
||||
|
||||
shutdownContext, shutdownCancel := context.WithTimeout(
|
||||
context.Background(),
|
||||
cfg.ShutdownTimeout,
|
||||
|
||||
Reference in New Issue
Block a user