Skip to content

Commit

Permalink
fix: disable get parents cid until needed
Browse files Browse the repository at this point in the history
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
  • Loading branch information
gfanton committed Mar 30, 2022
1 parent 4a76ce0 commit da2acaf
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions go/pkg/bertyprotocol/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ func newEventContext(eventID cid.Cid, parentIDs []cid.Cid, g *protocoltypes.Grou
}
}

// FIXME(gfanton): getParentsCID use a lot of ressources
// nolint:unused
func getParentsForCID(log ipfslog.Log, c cid.Cid) []cid.Cid {
if log == nil {
// TODO: this should not happen
Expand Down Expand Up @@ -87,15 +89,17 @@ func getParentsForCID(log ipfslog.Log, c cid.Cid) []cid.Cid {
return ret
}

func newGroupMetadataEventFromEntry(log ipfslog.Log, e ipfslog.Entry, metadata *protocoltypes.GroupMetadata, event proto.Message, g *protocoltypes.Group, attachmentsCIDs [][]byte) (*protocoltypes.GroupMetadataEvent, error) {
func newGroupMetadataEventFromEntry(_ ipfslog.Log, e ipfslog.Entry, metadata *protocoltypes.GroupMetadata, event proto.Message, g *protocoltypes.Group, attachmentsCIDs [][]byte) (*protocoltypes.GroupMetadataEvent, error) {
// TODO: if parent is a merge node we should return the next nodes of it

eventBytes, err := proto.Marshal(event)
if err != nil {
return nil, errcode.ErrSerialization
}

evtCtx := newEventContext(e.GetHash(), getParentsForCID(log, e.GetHash()), g, attachmentsCIDs)
// TODO(gfanton): getParentsCID use a lot of ressources, disable it until we need it
// evtCtx := newEventContext(e.GetHash(), getParentsForCID(log, e.GetHash()), g, attachmentsCIDs)
evtCtx := newEventContext(e.GetHash(), []cid.Cid{}, g, attachmentsCIDs)

gme := protocoltypes.GroupMetadataEvent{
EventContext: evtCtx,
Expand Down

0 comments on commit da2acaf

Please sign in to comment.