this repo has no description
0
fork

Configure Feed

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

make testing slow consumers easy (#429)

used this for testing the bugfix PR earlier

authored by

Jaz and committed by
GitHub
644d4f9c 9ed75848

+13
+13
cmd/gosky/main.go
··· 25 25 "github.com/bluesky-social/indigo/util" 26 26 "github.com/bluesky-social/indigo/util/cliutil" 27 27 "github.com/bluesky-social/indigo/xrpc" 28 + "golang.org/x/time/rate" 28 29 29 30 "github.com/gorilla/websocket" 30 31 lru "github.com/hashicorp/golang-lru" ··· 143 144 &cli.BoolFlag{ 144 145 Name: "resolve-handles", 145 146 }, 147 + &cli.Float64Flag{ 148 + Name: "max-throughput", 149 + Usage: "limit event consumption to a given # of req/sec (debug utility)", 150 + }, 146 151 }, 147 152 ArgsUsage: `[<repo> [cursor]]`, 148 153 Action: func(cctx *cli.Context) error { ··· 203 208 204 209 return h, nil 205 210 } 211 + var limiter *rate.Limiter 212 + if cctx.Float64("max-throughput") > 0 { 213 + limiter = rate.NewLimiter(rate.Limit(cctx.Float64("max-throughput")), 1) 214 + } 206 215 207 216 rsc := &events.RepoStreamCallbacks{ 208 217 RepoCommit: func(evt *comatproto.SyncSubscribeRepos_Commit) error { 218 + if limiter != nil { 219 + limiter.Wait(ctx) 220 + } 221 + 209 222 if jsonfmt { 210 223 b, err := json.Marshal(evt) 211 224 if err != nil {