From a960622c1f52405897e55237808e917cbc897fab Mon Sep 17 00:00:00 2001 From: Kyle Maas Date: Mon, 16 Jan 2023 01:21:04 +0000 Subject: [PATCH 1/2] Fix idxInSync, WaitUntilIndexesAreSynced, and TestNames --- sbot/indexes.go | 13 ++++++++++++- sbot/names_test.go | 3 ++- 2 files changed, 14 insertions(+), 2 deletions(-) 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..df841fe9 100644 --- a/sbot/names_test.go +++ b/sbot/names_test.go @@ -100,7 +100,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) From c82cf59eafb5ee3033155906cfa8f941d1a917cc Mon Sep 17 00:00:00 2001 From: Kyle Maas Date: Mon, 16 Jan 2023 01:26:11 +0000 Subject: [PATCH 2/2] Re-enable CI for NamesTest --- sbot/names_test.go | 6 ------ 1 file changed, 6 deletions(-) diff --git a/sbot/names_test.go b/sbot/names_test.go index df841fe9..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