Skip to content

Conversation

kirugan
Copy link
Contributor

@kirugan kirugan commented Sep 19, 2025

No description provided.

@Copilot Copilot AI review requested due to automatic review settings September 19, 2025 11:44
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances error handling in the Stop() methods by collecting and returning all errors instead of failing fast on the first error encountered. The change ensures that cleanup operations continue even if one component fails to stop properly.

  • Changed Stop() methods to collect all errors instead of returning immediately on first error
  • Used errors.Join() to combine multiple errors into a single return value
  • Ensures both queue components attempt to stop regardless of individual failures

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
queuemngr/queue_manager.go Modified Stop() method to collect errors from both queues and return combined result
client/rabbitmq_client.go Updated Stop() method to attempt closing both channel and connection, returning combined errors

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One important note: errors.Join(...) returns nil in 2 cases:

  1. when no arguments provided like: errors.Join(emptySlice...)
  2. all arguments (=errors) are nil: errors.Join(nilErrorVar, someNilErrorVar)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

second case is what we have here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants