File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed
Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -65,17 +65,18 @@ func (qs *QueueService) Start(ctx context.Context) (err error) {
6565// Stop stops the queue service by stopping the consumer and closing the publisher.
6666// It returns an error if there was an issue stopping the consumer or closing the publisher.
6767func (qs * QueueService ) Stop (ctx context.Context ) error {
68- if qs .consumer == nil {
69- return errors .New ("consumer is not defined" )
70- }
71- err := qs .consumer .Stop (ctx )
72- if err != nil {
73- return err
68+ if qs .consumer != nil {
69+ err := qs .consumer .Stop (ctx )
70+ if err != nil {
71+ return err
72+ }
7473 }
7574
76- err = qs .publisher .Close (ctx )
77- if err != nil {
78- return err
75+ if qs .publisher != nil {
76+ err := qs .publisher .Close (ctx )
77+ if err != nil {
78+ return err
79+ }
7980 }
8081 return nil
8182}
You can’t perform that action at this time.
0 commit comments