diff --git a/sbot/indexes.go b/sbot/indexes.go index 5821d9ff..986d942a 100644 --- a/sbot/indexes.go +++ b/sbot/indexes.go @@ -199,7 +199,18 @@ func (s *Sbot) serveIndexFrom(name string, snk librarian.SinkIndex, msgs margare s.indexStates[name] = "live" s.indexStateMu.Unlock() - err = luigi.Pump(s.rootCtx, snk, src) + startWaiting := func() { + } + doneWaiting := func() { + } + startProcessing := func() { + s.idxInSync.Add(1) + } + doneProcessing := func() { + s.idxInSync.Done() + } + + err = luigi.PumpWithStatus(s.rootCtx, snk, src, startWaiting, doneWaiting, startProcessing, doneProcessing) if errors.Is(err, ssb.ErrShuttingDown) || errors.Is(err, context.Canceled) { return nil } diff --git a/sbot/names_test.go b/sbot/names_test.go index 842258bb..6fbecd7b 100644 --- a/sbot/names_test.go +++ b/sbot/names_test.go @@ -18,16 +18,10 @@ import ( refs "github.com/ssbc/go-ssb-refs" "github.com/ssbc/go-ssb/client" "github.com/ssbc/go-ssb/internal/leakcheck" - "github.com/ssbc/go-ssb/internal/testutils" "github.com/ssbc/go-ssb/repo" ) func TestNames(t *testing.T) { - if testutils.SkipOnCI(t) { - // https://github.com/ssbc/go-ssb/pull/170 - return - } - if os.Getenv("LIBRARIAN_WRITEALL") != "0" { t.Fatal("please 'export LIBRARIAN_WRITEALL=0' for this test to pass") // TODO: expose index flushing @@ -100,7 +94,8 @@ func TestNames(t *testing.T) { checkLogSeq(mainbot.ReceiveLog, len(intros)-1) // got all the messages - // TODO: flush indexes + // flush indexes + mainbot.WaitUntilIndexesAreSynced() c, err := client.NewUnix(filepath.Join(tRepoPath, "socket")) r.NoError(err)