Monorepo for Tangled
0

Configure Feed

Select the types of activity you want to include in your feed.

knotmirror/xrpc: proxy getTree calls to knots

Signed-off-by: Seongmin Lee <git@boltless.me>

Seongmin Lee (May 15, 2026, 2:37 PM +0900) cfd2c460 82b6fd55

+14 -13
+14 -13
knotmirror/xrpc/git_get_tree.go
··· 5 5 "fmt" 6 6 "net/http" 7 7 "path/filepath" 8 - "runtime/pprof" 9 8 "time" 10 9 "unicode/utf8" 11 10 ··· 21 20 var ( 22 21 repoQuery = r.URL.Query().Get("repo") 23 22 ref = r.URL.Query().Get("ref") // ref can be empty (git.Open handles this) 24 - path = r.URL.Query().Get("path") // path can be empty (defaults to root) 23 + _ = r.URL.Query().Get("path") // path can be empty (defaults to root) 25 24 ) 26 25 l := x.logger.With("method", "git.getTree", "repo", repoQuery, "ref", ref) 27 26 l.Debug("request") ··· 32 31 return 33 32 } 34 33 35 - var out *tangled.GitTempGetTree_Output 36 - pprof.Do(r.Context(), pprof.Labels("repo", repo.String()), func(ctx context.Context) { 37 - out, err = x.getTree(ctx, repo, ref, path) 38 - }) 39 - if err != nil { 40 - l.Warn("local mirror failed, trying proxy", "repo", repo, "err", err) 41 - if x.proxyToKnot(w, r, repo) { 42 - return 43 - } 44 - writeJson(w, http.StatusInternalServerError, atclient.ErrorBody{Name: "InternalServerError", Message: "failed to get tree"}) 34 + if x.proxyToKnot(w, r, repo) { 45 35 return 46 36 } 47 - writeJson(w, http.StatusOK, out) 37 + writeJson(w, http.StatusInternalServerError, atclient.ErrorBody{Name: "InternalServerError", Message: "failed to get tree"}) 38 + // var out *tangled.GitTempGetTree_Output 39 + // out, err = x.getTree(r.Context(), repo, ref, path) 40 + // if err != nil { 41 + // l.Warn("local mirror failed, trying proxy", "repo", repo, "err", err) 42 + // if x.proxyToKnot(w, r, repo) { 43 + // return 44 + // } 45 + // writeJson(w, http.StatusInternalServerError, atclient.ErrorBody{Name: "InternalServerError", Message: "failed to get tree"}) 46 + // return 47 + // } 48 + // writeJson(w, http.StatusOK, out) 48 49 } 49 50 50 51 func (x *Xrpc) getTree(ctx context.Context, repo syntax.DID, ref, path string) (*tangled.GitTempGetTree_Output, error) {