an app.bsky.* indexer

Compare changes

Choose any two refs to compare.

Changed files
+9 -25
cmd
+1 -4
cmd/monarch/cursors.go
···
import (
"context"
"log/slog"
-
"sync"
"time"
"gorm.io/gorm"
)
type CursorService struct {
-
store *gorm.DB
-
-
firehoseLk sync.Mutex
+
store *gorm.DB
firehoseSeq int64
}
+6 -9
cmd/monarch/backfill.go
···
package main
import (
-
"github.com/bluesky-social/indigo/backfill"
+
backfill "github.com/bluesky-social/indigo/backfill/next"
"github.com/urfave/cli/v2"
)
func NewBackfillService(store backfill.Store, h *HandlerService, cctx *cli.Context) *backfill.Backfiller {
-
opts := &backfill.BackfillOptions{
-
ParallelBackfills: cctx.Int("backfill-workers"),
-
ParallelRecordCreates: cctx.Int("backfill-consumers"),
-
NSIDFilter: "",
-
SyncRequestsPerSecond: cctx.Int("sync-requests-limit"),
-
RelayHost: "https://" + cctx.String("relay-host"),
-
}
+
opts := backfill.DefaultBackfillerOptions()
+
opts.PerPDSBackfillConcurrency = cctx.Int("backfill-workers")
+
opts.GlobalRecordCreateConcurrency = cctx.Int("backfill-consumers")
+
opts.PerPDSSyncsPerSecond = cctx.Float64("sync-requests-limit")
-
return backfill.NewBackfiller("backfiller", store, h.HandleCreate, h.HandleUpdate, h.HandleDelete, opts)
+
return backfill.NewBackfiller("backfiller", store, h.HandleCreate, opts)
}
+2 -12
cmd/monarch/census.go
···
"time"
"github.com/bluesky-social/indigo/api/atproto"
-
"github.com/bluesky-social/indigo/backfill"
+
backfill "github.com/bluesky-social/indigo/backfill/next"
"github.com/bluesky-social/indigo/xrpc"
"github.com/urfave/cli/v2"
"golang.org/x/sync/semaphore"
···
seenHosts map[string]bool
}
-
type jobMaker interface {
-
GetOrCreateJob(context.Context, string, string) (backfill.Job, error)
-
}
-
func NewCensusService(cursorSvc *CursorService, backfillSvc *backfill.Backfiller) *CensusService {
return &CensusService{
cursor: cursorSvc,
···
Host: "https://" + host,
}
-
jmstore, ok := cs.backfill.Store.(jobMaker)
-
if !ok {
-
slog.Error("configured job store doesn't support random job creation")
-
return
-
}
-
hcur, err := cs.cursor.GetHostCursor(host)
if err != nil {
slog.Error("error fetching host cursor", "err", err)
···
}
for _, repo := range res.Repos {
-
_, err := jmstore.GetOrCreateJob(ctx, repo.Did, backfill.StateEnqueued)
+
err := cs.backfill.EnqueueJob(ctx, host, repo.Did)
if err != nil {
slog.Error("error adding repo to backfiller", "err", err)
} else {