Skip to content

Commit

Permalink
feat(network): subscribe to conversations on node init
Browse files Browse the repository at this point in the history
Signed-off-by: Godefroy Ponsinet <godefroy.ponsinet@outlook.com>
  • Loading branch information
90dy committed Sep 24, 2018
1 parent 7d6776a commit 623d220
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion core/node/network.go
Expand Up @@ -3,6 +3,7 @@ package node
import (
"context"

"berty.tech/core/entity"
"berty.tech/core/network"
"go.uber.org/zap"
)
Expand All @@ -26,7 +27,22 @@ func (n *Node) UseNetworkDriver(driver network.Driver) error {
zap.Error(err),
)
}

// FIXME: subscribe to every owned device IDs
// FIXME: subscribe to every joined conversations
// var devices []entity.Device
// n.sql.Table("device").Select("id").Find(&devices)
// for _, device := range devices {
// if err := n.networkDriver.Join(context.Background(), device.ID); err != nil {
// logger().Warn(err.Error())
// }
// }

var conversations []entity.Conversation
n.sql.Table("conversation").Select("id").Find(&conversations)
for _, conversation := range conversations {
if err := n.networkDriver.Join(context.Background(), conversation.ID); err != nil {
logger().Warn(err.Error())
}
}
return nil
}

0 comments on commit 623d220

Please sign in to comment.