+6
-5
splitter/handlers.go
+6
-5
splitter/handlers.go
···
65
65
}
66
66
67
67
// if that was successful, then forward on to the other upstreams (in goroutines)
68
-
for _, c := range s.nextCrawlers {
68
+
for _, nc := range s.nextCrawlers {
69
69
// intentional local copy of loop variable
70
-
hostname := c.String()
70
+
crawler := nc.String()
71
71
go func() {
72
72
// new context to outlive original HTTP request
73
73
ctx := context.Background()
74
74
xrpcc := xrpc.Client{
75
75
Client: s.peerClient,
76
-
Host: hostname,
76
+
Host: crawler,
77
77
}
78
78
if err := comatproto.SyncRequestCrawl(ctx, &xrpcc, &body); err != nil {
79
-
s.logger.Warn("failed to forward requestCrawl", "upstream", hostname, "targetHost", body.Hostname, "err", err)
79
+
s.logger.Warn("failed to forward requestCrawl", "crawler", crawler, "targetHost", body.Hostname, "err", err)
80
+
} else {
81
+
s.logger.Info("successfully forwarded requestCrawl", "crawler", crawler, "targetHost", body.Hostname)
80
82
}
81
-
s.logger.Info("successfully forwarded requestCrawl", "upstream", hostname, "targetHost", body.Hostname)
82
83
}()
83
84
}
84
85