Skip to content

Commit 1afc248

Browse files
committed
add missing godoc for private methods
1 parent 7414b46 commit 1afc248

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

terminator.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ func (t *Terminator) Wait(appCtx context.Context, shutdownTimeout time.Duration)
105105
}
106106
}
107107

108-
// waitShutdown waits for the context to be done and then sequentially notifies existing shutdown hooks.
108+
// waitShutdown waits for the context to be canceled and then executes the registered shutdown hooks sequentially.
109109
func (t *Terminator) waitShutdown(appCtx context.Context) {
110110
defer t.wg.Done()
111111

@@ -119,6 +119,7 @@ func (t *Terminator) waitShutdown(appCtx context.Context) {
119119
}
120120
}
121121

122+
// getSortedOrders returns a slice of hook orders sorted in ascending order.
122123
func (t *Terminator) getSortedOrders() []Order {
123124
orders := make([]Order, 0, len(t.hooks))
124125
for order := range t.hooks {
@@ -130,6 +131,7 @@ func (t *Terminator) getSortedOrders() []Order {
130131
return orders
131132
}
132133

134+
// processOrder executes all hooks associated with the given order concurrently and waits for all to finish.
133135
func (t *Terminator) processOrder(order Order) {
134136
var wg sync.WaitGroup
135137
for _, hook := range t.hooks[order] {
@@ -144,6 +146,7 @@ func (t *Terminator) processOrder(order Order) {
144146
wg.Wait()
145147
}
146148

149+
// executeHook runs a single hook with a timeout, recovers from panics, and logs the outcome.
147150
func (t *Terminator) executeHook(hook Hook) {
148151
ctx, cancel := context.WithTimeout(context.Background(), hook.timeout)
149152
defer cancel()

0 commit comments

Comments
 (0)