Monorepo for Tangled
0

Configure Feed

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

knotmirror: ping appview after indexing language

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

authored by

Seongmin Lee and committed by
Tangled
(Jul 9, 2026, 1:08 PM +0300) c661a193 915e831c

+27
+1
docker-compose.yml
··· 264 264 MIRROR_KNOT_USE_SSL: "true" 265 265 MIRROR_KNOT_SSRF: "true" 266 266 MIRROR_RESYNC_PARALLELISM: "4" 267 + MIRROR_APPVIEW_URL: http://appview:3000 267 268 MIRROR_SEARCH_ZOEKT_URL: https://zoekt.tngl.boltless.dev/indexserver 268 269 volumes: 269 270 - knotmirror-data:/data
+1
knotmirror/config/config.go
··· 8 8 ) 9 9 10 10 type Config struct { 11 + AppviewUrl string `env:"MIRROR_APPVIEW_URL, default=https://tangled.org"` 11 12 PlcUrl string `env:"MIRROR_PLC_URL, default=https://plc.directory"` 12 13 TapUrl string `env:"MIRROR_TAP_URL, default=http://localhost:2480"` 13 14 DbUrl string `env:"MIRROR_DB_URL, required"`
+25
knotmirror/repoindexer/language.go
··· 8 8 "fmt" 9 9 "io" 10 10 "log/slog" 11 + "net/http" 11 12 "path/filepath" 12 13 "strings" 13 14 "time" ··· 94 95 if err := db.InsertLanguages(ctx, e, repoId, commit.Hash, langs); err != nil { 95 96 return fmt.Errorf("failed to insert langs into db: %w", err) 96 97 } 98 + 99 + // HACK(boltless): ping appview to update language cache. 100 + go func() { 101 + url := fmt.Sprintf("%s/%s", cfg.AppviewUrl, repoId.String()) 102 + pingCtx, cancel := context.WithTimeout(ctx, 5*time.Second) 103 + defer cancel() 104 + req, err := http.NewRequestWithContext(pingCtx, http.MethodGet, url, nil) 105 + if err != nil { 106 + l.Warn("appview ping: build request failed", "err", err) 107 + return 108 + } 109 + resp, err := http.DefaultClient.Do(req) 110 + if err != nil { 111 + l.Warn("appview ping failed", "url", url, "err", err) 112 + return 113 + } 114 + defer resp.Body.Close() 115 + // drain body to ensure the appview completes rendering 116 + if _, err := io.Copy(io.Discard, resp.Body); err != nil { 117 + l.Warn("appview ping: drain response failed", "url", url, "err", err) 118 + return 119 + } 120 + l.Info("appview pinged", "url", url, "status", resp.StatusCode) 121 + }() 97 122 98 123 return nil 99 124 },