ssbc / ssb-meta-feeds

10 stars 0 forks source link

Ordering of messages #117

Open arj03 opened 1 year ago

arj03 commented 1 year ago

I'm looking at a trace that looks something like this:

notify branch [ 'root', 'v1' ] ssb:feed/bendybutt-v1/PVC3N4bEm5cVk5PMwZZ2BYI414B4kaqgxYyWsx29w5g=
got branch [ 'root', 'v1' ]
notify branch [ 'root', 'v1', '4' ] ssb:feed/bendybutt-v1/hqBQcbGAAKc5sG5oaJ4yzLwKipXmaVC6OmmOjFB---c=
got branch [ 'root', 'v1', '4' ]
notify branch [ 'root', 'v1', '4', 'main' ] @3XVgQP3VFF4r+YMtJk3QgOSz5zAWvfZXS0zYfqppf14=.ed25519
got branch [ 'root', 'v1', '4', 'main' ]
notify branch [ 'root', 'group/additions' ] @oH4x34UXqEkdUaJ2aY83+l6ZftNzJ6k7BU2hS8Edxkk=.ed25519
notify branch [ '1' ] ssb:feed/bendybutt-v1/TH9SxgrS2vHbp6iRsSlS3SaqFrIn-8-DzB4t-dNig5g=
got branch [ '1', 'group/additions' ]
got branch [ '1' ]

Got branch is what you get from ssb.metafeeds.branchStream({ old: true, live: true }) and notify is from inside this module on live data.

The tree looks like this:

root
└─┬ v1
  ├─┬ 4
  │ └── main
  └─┬ 1
    └── group/additions

For some reason it seems like 1 doesn't have a proper parent (v1), which is really strange because it seems like 4 works fine.

arj03 commented 1 year ago

Aha, this one seems to be buggy:

https://github.com/ssbc/ssb-meta-feeds/blob/08ef0edeff00fa9bf3a1f9b9b6bd77589647e859/FeedDetails.js#L176

Doesn't update parent. There is more though.

arj03 commented 1 year ago

And the second bug seems to be that the messages comes in the wrong order. updateLookupFromMsg first gets the group/additions and later the 1. So the parent links don't correctly align. It's a bit strange, because the messages from network should come in, in the correct order. So it's a bit strange that we would get them shuffled.

arj03 commented 1 year ago

Argh fuck. It's because replicate is cheating and just requests all feeds at once. https://github.com/ssbc/ssb-tribes2/blob/4beef23cc85cd2fd4f34a1ab8e3f63bc3d54daba/test/helpers/replicate.js#L13