Skip to content

Agent Mesh

reduce log noise

Antonio Ojea6100d94b1e99
diff --git a/cmd/sam-hub/main.go b/cmd/sam-hub/main.go
index 453140d5..6689def7 100644
--- a/cmd/sam-hub/main.go
+++ b/cmd/sam-hub/main.go
@@ -619,6 +619,8 @@ func main() {
_ = os.Setenv("GOLOG_LOG_FMT", "json")
}
golog.SetAllLoggers(golog.LevelInfo)
+ _ = golog.SetLogLevel("dht", "fatal")
+ _ = golog.SetLogLevel("dht/RtRefreshManager", "fatal")
if logLevel != "" {
lvl, err := golog.LevelFromString(logLevel)
if err == nil {
diff --git a/cmd/sam-node/main.go b/cmd/sam-node/main.go
index 41c56bdf..8bcf4d3d 100644
--- a/cmd/sam-node/main.go
+++ b/cmd/sam-node/main.go
@@ -95,6 +95,8 @@ func main() {
ctx := cmd.Context()
// Initialize logging
golog.SetAllLoggers(golog.LevelInfo)
+ _ = golog.SetLogLevel("dht", "fatal")
+ _ = golog.SetLogLevel("dht/RtRefreshManager", "fatal")
if logLevelFlag != "" {
lvl, err := golog.LevelFromString(logLevelFlag)
if err == nil {
diff --git a/cmd/sam-node/mcp.go b/cmd/sam-node/mcp.go
index 98cef5b7..04ac130c 100644
--- a/cmd/sam-node/mcp.go
+++ b/cmd/sam-node/mcp.go
@@ -146,7 +146,11 @@ func (n *SamNode) CallMCPTool(ctx context.Context, targetPeer peer.ID, toolName
return res, nil
}
logger.Warnf("[MCP] Tool call failed, retrying in %v: %v", backoff, err)
- time.Sleep(backoff)
+ select {
+ case <-ctx.Done():
+ return nil, fmt.Errorf("context canceled during retry: %w", ctx.Err())
+ case <-time.After(backoff):
+ }
backoff *= 2
}
return nil, fmt.Errorf("failed after %d retries: %w", maxRetries, err)