this repo has no description
0
fork

Configure Feed

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

fix loop closure issue (#128)

I thought that our linter would have caught this, but apparently it only
catches certain shapes of this bug.
Probably worth auditing the rest of the codebase for this problem at
some point (or just wait for the go team to fix it like jake said they
might)

authored by

Whyrusleeping and committed by
GitHub
362e5365 8c8248dc

+24 -2
+10
bgs/bgs.go
··· 152 152 }) 153 153 http.Handle("/prometheus", prometheusHandler()) 154 154 155 + http.HandleFunc("/debug/upstream-conns", func(w http.ResponseWriter, r *http.Request) { 156 + b, err := json.Marshal(bgs.slurper.GetActiveList()) 157 + if err != nil { 158 + http.Error(w, err.Error(), 500) 159 + return 160 + } 161 + 162 + w.Write(b) 163 + }) 164 + 155 165 return http.ListenAndServe(listen, nil) 156 166 } 157 167
+14 -2
bgs/fedmgr.go
··· 92 92 } 93 93 94 94 for _, pds := range all { 95 + pds := pds 96 + s.active[pds.Host] = &pds 95 97 go s.subscribeWithRedialer(&pds) 96 98 } 97 99 ··· 160 162 161 163 return events.HandleRepoStream(ctx, con, &events.RepoStreamCallbacks{ 162 164 RepoCommit: func(evt *comatproto.SyncSubscribeRepos_Commit) error { 163 - 164 - log.Infow("got remote repo event", "host", host.Host, "repo", evt.Repo) 165 + log.Infow("got remote repo event", "host", host.Host, "repo", evt.Repo, "seq", evt.Seq) 165 166 if err := s.cb(context.TODO(), host, &events.XRPCStreamEvent{ 166 167 RepoCommit: evt, 167 168 }); err != nil { ··· 234 235 func (s *Slurper) updateCursor(host *models.PDS, curs int64) error { 235 236 return s.db.Model(models.PDS{}).Where("id = ?", host.ID).UpdateColumn("cursor", curs).Error 236 237 } 238 + 239 + func (s *Slurper) GetActiveList() []string { 240 + s.lk.Lock() 241 + defer s.lk.Unlock() 242 + var out []string 243 + for k := range s.active { 244 + out = append(out, k) 245 + } 246 + 247 + return out 248 + }