Skip to content

Commit

Permalink
fix: message queue open too early
Browse files Browse the repository at this point in the history
Signed-off-by: gfanton <[email protected]>
  • Loading branch information
gfanton committed Jun 26, 2023
1 parent 3de041b commit 175f31c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion account_export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import (
"io"
"os"
"testing"
"time"

mocknet "github.com/berty/go-libp2p-mock"
"github.com/ipfs/go-cid"
ds "github.com/ipfs/go-datastore"
dsync "github.com/ipfs/go-datastore/sync"
mocknet "github.com/berty/go-libp2p-mock"
"github.com/stretchr/testify/require"

orbitdb "berty.tech/go-orbit-db"
Expand Down Expand Up @@ -217,6 +218,8 @@ func TestRestoreAccount(t *testing.T) {
_, err = nodeB.Service.ActivateGroup(ctx, &protocoltypes.ActivateGroup_Request{GroupPK: g.PublicKey})
require.NoError(t, err)

<-time.After(time.Millisecond * 500)

for _, gPK := range [][]byte{nodeBInstanceConfig.AccountGroupPK, g.PublicKey} {
sub, err := nodeB.Client.GroupMessageList(
ctx,
Expand Down
3 changes: 2 additions & 1 deletion store_message.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,8 @@ func (m *MessageStore) ListEvents(ctx context.Context, since, until []byte, reve
func(entry ipliface.IPFSLogEntry) {
message, err := m.openMessage(ctx, entry)
if err != nil {
m.logger.Error("unable to open message", zap.Error(err))
m.logger.Error("unable to open message, adding to queue for later decrypt", zap.Error(err))

} else {
out <- message
m.logger.Info("message store - sent 1 event from log history")
Expand Down

0 comments on commit 175f31c

Please sign in to comment.