-
Notifications
You must be signed in to change notification settings - Fork 554
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Read after write #1398
Read after write #1398
Conversation
I was a bit worried we had specified ourself in to a corner, but thankfully:
@ericvolp12 had the idea to use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤯 a couple thoughts/questions, but you nailed it.
for (let i = 0; i < feed.length; i++) { | ||
if (feed[i].post.indexedAt < post.indexedAt) { | ||
feed.splice(i, 0, { post }) | ||
inserted = true | ||
break |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spidey senses tingled a little seeing a loop over feed
that also mutates feed
, but this should be fine since it causes a break.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cleaned it up a bit with a findIndex
instead 👌
* first pass on profiles * quick test * wip * wip * test post thread * record embeds * get author feed profiles * wip timeline * fix get timeline * switch from counter to tid * tidy into a service * quick tid test * pr feedback * clock -> rev * update image formatting * disable migration & build branch * add recent posts to getAuthorFeed & handle post thread not found errors * refactor for lag header * tidy * rm collections check * tidy test * pr feedback * fix small bug * build branch * get migrations into system * enable migrations
* first pass on profiles * quick test * wip * wip * test post thread * record embeds * get author feed profiles * wip timeline * fix get timeline * switch from counter to tid * tidy into a service * quick tid test * pr feedback * clock -> rev * update image formatting * disable migration & build branch * add recent posts to getAuthorFeed & handle post thread not found errors * refactor for lag header * tidy * rm collections check * tidy test * pr feedback * fix small bug * build branch * get migrations into system * enable migrations
This is a basic implementation of read stick on the pds which gives us read-after-write semantics for some operations.
The basic approach here is:
atproto-clock
) which includes it's last seen logical clock for the requesting userImportantly, while this includes application-specific logic, it does not include any application-specific indexes and may be done generically off of the record table.
The application of this read-sticky approach is not exhaustive. However, this applies it to some of the most common and impactful occurrences. Namely:
Note: this currently builds a PDS url for any local images that get added in, however after landing #1248, we can deterministically build appview image urls