···2626 since = &sval
2727 }
28282929+ // NOTE: the request context outlives the HTTP 101 response; it lives as long as the WebSocket is open, and then get cancelled. That is the behavior we want for this ctx, but should be careful if spawning goroutines which should outlive the WebSocket connection.
3030+ // https://github.com/bluesky-social/indigo/pull/1023#pullrequestreview-2768335762
2931 ctx, cancel := context.WithCancel(c.Request().Context())
3032 defer cancel()
3133
+6-3
splitter/handlers.go
···66666767 // if that was successful, then forward on to the other upstreams (in goroutines)
6868 for _, c := range s.nextCrawlers {
6969+ // intentional local copy of loop variable
7070+ hostname := c.String()
6971 go func() {
7272+ // new context to outlive original HTTP request
7073 ctx := context.Background()
7174 xrpcc := xrpc.Client{
7275 Client: s.upstreamClient,
7373- Host: c.String(),
7676+ Host: hostname,
7477 }
7578 if err := comatproto.SyncRequestCrawl(ctx, &xrpcc, &body); err != nil {
7676- s.logger.Warn("failed to forward requestCrawl", "upstream", c.String(), "targetHost", body.Hostname, "err", err)
7979+ s.logger.Warn("failed to forward requestCrawl", "upstream", hostname, "targetHost", body.Hostname, "err", err)
7780 }
7878- s.logger.Info("successfully forwarded requestCrawl", "upstream", c.String(), "targetHost", body.Hostname)
8181+ s.logger.Info("successfully forwarded requestCrawl", "upstream", hostname, "targetHost", body.Hostname)
7982 }()
8083 }
8184