Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

medsky radical trim of bigsky (relay) #951

Closed
wants to merge 11 commits into from
271 changes: 271 additions & 0 deletions api/atproto/cbor_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions atproto/identity/cache_directory.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/hashicorp/golang-lru/v2/expirable"
)

// CacheDirectory is an implementation of identity.Directory with local cache of Handle and DID
type CacheDirectory struct {
Inner Directory
ErrTTL time.Duration
Expand Down
1 change: 1 addition & 0 deletions bgs/bgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ func NewBGS(db *gorm.DB, ix *indexer.Indexer, repoman *repomgr.RepoManager, evtm
slOpts.DefaultRepoLimit = config.DefaultRepoLimit
slOpts.ConcurrencyPerPDS = config.ConcurrencyPerPDS
slOpts.MaxQueuePerPDS = config.MaxQueuePerPDS
slOpts.Logger = bgs.log
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just checking that these updates to the top-level bgs package (vs the "vendored" copy) are intentional. they seems small and fine

s, err := NewSlurper(db, bgs.handleFedEvent, slOpts)
if err != nil {
return nil, err
Expand Down
5 changes: 5 additions & 0 deletions bgs/fedmgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ type Slurper struct {
shutdownResult chan []error

ssl bool

log *slog.Logger
}

type Limiters struct {
Expand All @@ -73,6 +75,7 @@ type SlurperOptions struct {
DefaultRepoLimit int64
ConcurrencyPerPDS int64
MaxQueuePerPDS int64
Logger *slog.Logger
}

func DefaultSlurperOptions() *SlurperOptions {
Expand All @@ -85,6 +88,7 @@ func DefaultSlurperOptions() *SlurperOptions {
DefaultRepoLimit: 100,
ConcurrencyPerPDS: 100,
MaxQueuePerPDS: 1_000,
Logger: slog.Default(),
}
}

Expand Down Expand Up @@ -115,6 +119,7 @@ func NewSlurper(db *gorm.DB, cb IndexCallback, opts *SlurperOptions) (*Slurper,
ssl: opts.SSL,
shutdownChan: make(chan bool),
shutdownResult: make(chan []error),
log: opts.Logger,
}
if err := s.loadConfig(); err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion cmd/bigsky/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ func runBigsky(cctx *cli.Context) error {
signals := make(chan os.Signal, 1)
signal.Notify(signals, syscall.SIGINT, syscall.SIGTERM)

_, err := cliutil.SetupSlog(cliutil.LogOptions{})
_, _, err := cliutil.SetupSlog(cliutil.LogOptions{})
if err != nil {
return err
}
Expand Down
9 changes: 5 additions & 4 deletions cmd/goat/firehose.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,19 @@ func runFirehose(cctx *cli.Context) error {
}

relayHost := cctx.String("relay-host")
cursor := cctx.Int("cursor")

dialer := websocket.DefaultDialer
u, err := url.Parse(relayHost)
if err != nil {
return fmt.Errorf("invalid relayHost URI: %w", err)
}
u.Path = "xrpc/com.atproto.sync.subscribeRepos"
if cursor != 0 {
u.RawQuery = fmt.Sprintf("cursor=%d", cursor)
if cctx.IsSet("cursor") {
u.RawQuery = fmt.Sprintf("cursor=%d", cctx.Int("cursor"))
}
con, _, err := dialer.Dial(u.String(), http.Header{
urlString := u.String()
slog.Debug("GET", "url", urlString)
con, _, err := dialer.Dial(urlString, http.Header{
"User-Agent": []string{fmt.Sprintf("goat/%s", versioninfo.Short())},
})
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/gosky/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func run(args []string) {
},
}

_, err := cliutil.SetupSlog(cliutil.LogOptions{})
_, _, err := cliutil.SetupSlog(cliutil.LogOptions{})
if err != nil {
fmt.Fprintf(os.Stderr, "logging setup error: %s\n", err.Error())
os.Exit(1)
Expand Down
Loading