@@ -114,16 +114,16 @@ func (consumer *Consumer) Run(handler Handler) error {
114
114
}
115
115
116
116
// Close cleans up resources and closes the consumer.
117
- // It waits for all handlers to finish before returning by default
117
+ // It waits for handler to finish before returning by default
118
118
// (use WithConsumerOptionsForceShutdown option to disable this behavior).
119
- // Use CloseWithContext to specify a context to cancel the handlers completion.
119
+ // Use CloseWithContext to specify a context to cancel the handler completion.
120
120
// It does not close the connection manager, just the subscription
121
121
// to the connection manager and the consuming goroutines.
122
122
// Only call once.
123
123
func (consumer * Consumer ) Close () {
124
124
if consumer .options .CloseGracefully {
125
- consumer .options .Logger .Infof ("waiting for handlers to finish..." )
126
- err := consumer .waitForHandlers (context .Background ())
125
+ consumer .options .Logger .Infof ("waiting for handler to finish..." )
126
+ err := consumer .waitForHandlerCompletion (context .Background ())
127
127
if err != nil {
128
128
consumer .options .Logger .Warnf ("error while waiting for handler to finish: %v" , err )
129
129
}
@@ -151,15 +151,15 @@ func (consumer *Consumer) cleanupResources() {
151
151
}
152
152
153
153
// CloseWithContext cleans up resources and closes the consumer.
154
- // It waits for all handlers to finish before returning
154
+ // It waits for handler to finish before returning
155
155
// (use WithConsumerOptionsForceShutdown option to disable this behavior).
156
- // Use the context to cancel the handlers completion.
156
+ // Use the context to cancel the handler completion.
157
157
// CloseWithContext does not close the connection manager, just the subscription
158
158
// to the connection manager and the consuming goroutines.
159
159
// Only call once.
160
160
func (consumer * Consumer ) CloseWithContext (ctx context.Context ) {
161
161
if consumer .options .CloseGracefully {
162
- err := consumer .waitForHandlers (ctx )
162
+ err := consumer .waitForHandlerCompletion (ctx )
163
163
if err != nil {
164
164
consumer .options .Logger .Warnf ("error while waiting for handler to finish: %v" , err )
165
165
}
@@ -256,7 +256,7 @@ func handlerGoroutine(consumer *Consumer, msgs <-chan amqp.Delivery, consumeOpti
256
256
consumer .options .Logger .Infof ("rabbit consumer goroutine closed" )
257
257
}
258
258
259
- func (consumer * Consumer ) waitForHandlers (ctx context.Context ) error {
259
+ func (consumer * Consumer ) waitForHandlerCompletion (ctx context.Context ) error {
260
260
if ctx == nil {
261
261
ctx = context .Background ()
262
262
} else if ctx .Err () != nil {
0 commit comments