Skip to content

Conversation

@ilija42
Copy link
Contributor

@ilija42 ilija42 commented May 22, 2025

Description

Requires Dependencies

Resolves Dependencies

@ilija42 ilija42 requested a review from a team as a code owner May 22, 2025 09:38
@ilija42 ilija42 requested a review from pavel-raykov May 22, 2025 09:38
@ilija42 ilija42 enabled auto-merge (squash) May 22, 2025 09:43
@ilija42 ilija42 requested a review from dhaidashenko May 22, 2025 09:43
var err error
if !l.ReceivingHeads() {
switch {
case !connected && !receivingHeads:
Copy link
Contributor

Choose a reason for hiding this comment

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

can we just use errors.Errorf("Listener connected = %t, receiving heads = %t") instead of this switch?

Copy link
Contributor Author

@ilija42 ilija42 May 22, 2025

Choose a reason for hiding this comment

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

Would look like this, I don't think it makes a difference

func (l *listener[HTH, S, ID, BLOCK_HASH]) HealthReport() map[string]error {
	receivingHeads := l.ReceivingHeads()
	connected := l.Connected()
	var err error
	if !receivingHeads || !connected {
		err = fmt.Errorf("Listener connected = %t, receiving heads = %t", connected, receivingHeads)
	}

	return map[string]error{l.Name(): err}
}

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be easier to parse in the logs + it would be easy to add another status. (hopefully, we don't care about few additional characters in the log output)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, updated

@ilija42 ilija42 requested a review from pavel-raykov May 22, 2025 10:29
@ilija42 ilija42 merged commit 65c5466 into main May 22, 2025
21 checks passed
@ilija42 ilija42 deleted the improve-head-listener-healthreport-formatting branch May 22, 2025 11:00
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.

4 participants