Skip to content
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

fix(project-cache): Merge instead of replace project state channel in upstream #3952

Merged
merged 4 commits into from
Oct 1, 2024

Conversation

Dav1dde
Copy link
Member

@Dav1dde Dav1dde commented Aug 27, 2024

Also described in code, while there is a request in flight we might get another request for the same project, when the response for the project is pending we replace the channel instead of merging it.

#skip-changelog

@Dav1dde Dav1dde requested a review from a team as a code owner August 27, 2024 11:47
@Dav1dde Dav1dde self-assigned this Aug 27, 2024
@Dav1dde Dav1dde force-pushed the dav1d/upstream-project-merge-channel branch from 2e3bc6b to baa1864 Compare August 27, 2024 11:48

self.other.push(channel);
self.other.extend(other);
self.deadline = self.deadline.max(deadline);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be the minimum? In theory the deadline could get bumped indefinitely here, which maybe isn't a bad thing?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think max is correct, matches the previous behavior more closely.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think min matches the previous behaviour more closely since we'd replace the newer entry with the older entry and the deadline is only computed once.

Copy link
Member

@jjbayer jjbayer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A test case would be nice.

channel: BroadcastChannel<ProjectFetchState>,
// Additional broadcast channels tracked from merge operations.
other: Vec<BroadcastChannel<ProjectFetchState>>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Could replace channel, other by a single SmallVec, to clarify that there is no real difference between the channels.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I explicitly have separate fields for this to guarantee there is always at least one channel, otherwise attaching requires a dance of channels.last().is_some().or_insert().


self.other.push(channel);
self.other.extend(other);
self.deadline = self.deadline.max(deadline);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think max is correct, matches the previous behavior more closely.

@Dav1dde
Copy link
Member Author

Dav1dde commented Aug 27, 2024

A test case would be nice.

Agreed just need to think of how to actually test this :(

@Dav1dde
Copy link
Member Author

Dav1dde commented Sep 30, 2024

Updated and added a test for exactly the case which was broken.

@Dav1dde Dav1dde merged commit 1030d15 into master Oct 1, 2024
23 checks passed
@Dav1dde Dav1dde deleted the dav1d/upstream-project-merge-channel branch October 1, 2024 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants