Skip to content

Conversation

@gacevicljubisa
Copy link
Member

@gacevicljubisa gacevicljubisa commented Jan 24, 2026

Checklist

  • I have read the coding guide.
  • My change requires a documentation update, and I have done it.
  • I have added tests to cover my changes.
  • I have filled out the description and linked the related issues.

Description

Previously, when many errors were joined together during sync
operations, all errors were logged in a single line, creating
log entries up to 30KB (e.g., 245 identical "batch not found"
errors).

This commit adds countErrors() to count total errors and logs
only the count plus one example error, keeping entries concise
while maintaining diagnostic value.

Changes:

  • Add countErrors() helper to count errors in joined error chains
  • Update syncWorker logging to show error_count and example_error
  • Add test coverage for error counting

Example output:

  • Before: "error"="batch not found\nbatch not found\n..." (30KB)
  • After: "error_count"=245 "example_error"="batch not found"

Open API Spec Version Changes (if applicable)

Motivation and Context (Optional)

Related Issue (Optional)

Screenshots (if appropriate):

Copy link
Member

@janos janos left a comment

Choose a reason for hiding this comment

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

The approach is maybe too high level. It looks to me that errors.Join is used in a way that is not ideal, maybe even misused. This is solving the problem with long log lines, but does not solve the root cause of using errors as lists of errors.

I would say that this is ok solution but ideally it would be better in the future to address the usage of errors.Join.

@@ -0,0 +1,72 @@
// Copyright 2025 The Swarm Authors. All rights reserved.
Copy link
Member

Choose a reason for hiding this comment

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

2025 -> 2026

@gacevicljubisa
Copy link
Member Author

The approach is maybe too high level. It looks to me that errors.Join is used in a way that is not ideal, maybe even misused. This is solving the problem with long log lines, but does not solve the root cause of using errors as lists of errors.

I would say that this is ok solution but ideally it would be better in the future to address the usage of errors.Join.

I agree.

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.

3 participants