Skip to content

Commit

Permalink
universe: improve logging for single asset sync attempt
Browse files Browse the repository at this point in the history
When syncing a single asset (for example for creating an address) fails,
the cause isn't easily visible in the logs. First, because the actual
remote error wasn't logged and second because it was logged as debug.
This commit fixes both.
  • Loading branch information
guggero committed Jan 13, 2025
1 parent 355ce1c commit 3fc077d
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions universe/auto_syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -846,18 +846,30 @@ func (f *FederationEnvoy) SyncAssetInfo(ctx context.Context,
// Sync failures are expected from Universe servers that do not
// have a relevant universe root.
if err != nil {
log.Debugf("asset lookup for %v failed with remote"+
"server: %v", assetID.String(), addr.HostStr())
//lint:ignore nilerr failure is expected and logged
log.Warnf("Asset lookup for %v failed with remote"+
"server '%v': %v", assetID.String(),
addr.HostStr(), err)

// We don't want to abort syncing here, as this might
// just be one server in our list and returning an error
// would cause us to stop trying the other servers.
// lint:ignore nilerr failure is expected and logged.
return nil
}

// There should only be one sync diff since we're only syncing
// one universe root.
if syncDiff != nil {
if len(syncDiff) != 1 {
log.Debugf("unexpected number of sync diffs: "+
"%v", len(syncDiff))
log.Warnf("Unexpected number of sync diffs %d "+
"when looking up asset %v on remote "+
"server '%v': %v", len(syncDiff),
assetID.String(), addr.HostStr(), err)

// We don't want to abort syncing here, as this
// might just be one server in our list and
// returning an error would cause us to stop
// trying the other servers.
return nil
}

Expand Down

0 comments on commit 3fc077d

Please sign in to comment.