Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion internal/state/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,11 @@ func (s *InternalState) CheckMembershipConsistency(ctx context.Context) error {
}

for {
ctxErr := ctx.Err()
Copy link
Contributor

Choose a reason for hiding this comment

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

The more I think about this, I am less confident that this copilot comment is actually useful.

If we call getMembershipData with an already expired context, we still get Failed to gather membership data for consistency check: context deadline exceeded which is explanatory enough IMHO.

So it's not that we loose anything around the fact we are trying to perform the consistency check. It's even written in the error message.

Let's just fix e76bcff#r2762736434 and we should be good to go. Fine for you?

Copy link
Contributor

Choose a reason for hiding this comment

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

I was proposing to again drop this ctxErr := ctx.Err() ... section as it looks to me the copilot comment wasn't that useful as we would still have a nice and descriptive error message returned by getMembershipData.

if ctxErr != nil {
return fmt.Errorf("Membership consistency check failed: %w", ctxErr)
}

coreClusterMembers, truststoreRemotes, dqliteNodes, err := s.getMembershipData(ctx)
if err != nil {
return fmt.Errorf("Failed to gather membership data for consistency check: %w", err)
Expand All @@ -258,7 +263,7 @@ func (s *InternalState) CheckMembershipConsistency(ctx context.Context) error {
if err != nil {
select {
case <-ctx.Done():
return fmt.Errorf("Membership consistency check failed after timeout: %w", err)
return fmt.Errorf("Membership consistency check failed: %w", err)
case <-time.After(200 * time.Millisecond):
continue
}
Expand Down