diff --git a/splitter/handlers.go b/splitter/handlers.go index b7048ae6..8ff7407f 100644 --- a/splitter/handlers.go +++ b/splitter/handlers.go @@ -65,20 +65,21 @@ func (s *Splitter) HandleComAtprotoSyncRequestCrawl(c echo.Context) error { } // if that was successful, then forward on to the other upstreams (in goroutines) - for _, c := range s.nextCrawlers { + for _, nc := range s.nextCrawlers { // intentional local copy of loop variable - hostname := c.String() + crawler := nc.String() go func() { // new context to outlive original HTTP request ctx := context.Background() xrpcc := xrpc.Client{ Client: s.peerClient, - Host: hostname, + Host: crawler, } if err := comatproto.SyncRequestCrawl(ctx, &xrpcc, &body); err != nil { - s.logger.Warn("failed to forward requestCrawl", "upstream", hostname, "targetHost", body.Hostname, "err", err) + s.logger.Warn("failed to forward requestCrawl", "crawler", crawler, "targetHost", body.Hostname, "err", err) + } else { + s.logger.Info("successfully forwarded requestCrawl", "crawler", crawler, "targetHost", body.Hostname) } - s.logger.Info("successfully forwarded requestCrawl", "upstream", hostname, "targetHost", body.Hostname) }() }