-
Notifications
You must be signed in to change notification settings - Fork 91
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
Conversation
2e3bc6b
to
baa1864
Compare
|
||
self.other.push(channel); | ||
self.other.extend(other); | ||
self.deadline = self.deadline.max(deadline); |
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.
Should this be the minimum? In theory the deadline could get bumped indefinitely here, which maybe isn't a bad thing?
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.
I think max is correct, matches the previous behavior more closely.
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.
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.
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 test case would be nice.
channel: BroadcastChannel<ProjectFetchState>, | ||
// Additional broadcast channels tracked from merge operations. | ||
other: Vec<BroadcastChannel<ProjectFetchState>>, |
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.
nit: Could replace channel, other
by a single SmallVec
, to clarify that there is no real difference between the channels.
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.
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); |
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.
I think max is correct, matches the previous behavior more closely.
Agreed just need to think of how to actually test this :( |
Updated and added a test for exactly the case which was broken. |
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