Monorepo for Tangled tangled.org
753
fork

Configure Feed

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

knotmirror: fail early if target knot is offline

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

+12
+5
knotmirror/models/models.go
··· 2 2 3 3 import ( 4 4 "fmt" 5 + "strings" 5 6 6 7 "github.com/bluesky-social/indigo/atproto/syntax" 7 8 "tangled.org/core/api/tangled" ··· 21 22 ErrorMsg string 22 23 RetryCount int 23 24 RetryAfter int64 // Unix timestamp (seconds) 25 + } 26 + 27 + func (r *Repo) KnotHostname() string { 28 + return strings.TrimPrefix(strings.TrimPrefix(r.KnotDomain, "https"), "http") 24 29 } 25 30 26 31 func (r *Repo) AtUri() syntax.ATURI {
+7
knotmirror/resyncer.go
··· 219 219 return false, nil 220 220 } 221 221 222 + // fail early if target knot is offline. 223 + if host, _ := db.GetHost(ctx, r.db, repo.KnotHostname()); host != nil { 224 + if host.Status != models.HostStatusActive { 225 + return false, nil 226 + } 227 + } 228 + 222 229 // HACK: check knot reachability with short timeout before running actual fetch. 223 230 // This is crucial as git-cli doesn't support http connection timeout. 224 231 // `http.lowSpeedTime` is only applied _after_ the connection.