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

upgrade to hashbrown 0.15.0 #1599

Merged
merged 1 commit into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ educe = { version = "0.6.0", default-features = false }
either = "1.6.1"
form_urlencoded = "1.2.0"
futures = { version = "0.3.17", default-features = false }
hashbrown = "0.14.0"
hashbrown = "0.15.0"
home = "0.5.4"
http = "1.1.0"
http-body = "1.0.0"
Expand Down
6 changes: 2 additions & 4 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ allow = [
# Pulled in via aws_lc_rs when using rustls-tls and aws-lc-rs features
# https://openssl-library.org/source/license/index.html
"OpenSSL",
# Pulled in via hashbrown through its foldhash dependency
"Zlib",
rorosen marked this conversation as resolved.
Show resolved Hide resolved
]

exceptions = [
Expand Down Expand Up @@ -64,10 +66,6 @@ multiple-versions = "deny"
[[bans.skip]]
name = "rustls-native-certs"

[[bans.skip]]
# blocked on us swapping out serde_yaml
name = "hashbrown"

[[bans.skip]]
# base64 did some annoying breaking changes
name = "base64"
Expand Down
16 changes: 8 additions & 8 deletions kube-runtime/src/scheduler.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Delays and deduplicates [`Stream`](futures::stream::Stream) items

use futures::{stream::Fuse, Stream, StreamExt};
use hashbrown::{hash_map::Entry, HashMap};
use hashbrown::{hash_map::RawEntryMut, HashMap};
use pin_project::pin_project;
use std::{
collections::HashSet,
Expand Down Expand Up @@ -78,24 +78,24 @@ impl<T: Hash + Eq + Clone, R> SchedulerProj<'_, T, R> {
.run_at
.checked_add(*self.debounce)
.unwrap_or_else(far_future);
match self.scheduled.entry(request.message) {
match self.scheduled.raw_entry_mut().from_key(&request.message) {
// If new request is supposed to be earlier than the current entry's scheduled
// time (for eg: the new request is user triggered and the current entry is the
// reconciler's usual retry), then give priority to the new request.
Entry::Occupied(mut old_entry) if old_entry.get().run_at >= request.run_at => {
RawEntryMut::Occupied(mut old_entry) if old_entry.get().run_at >= request.run_at => {
// Old entry will run after the new request, so replace it..
let entry = old_entry.get_mut();
self.queue.reset_at(&entry.queue_key, next_time);
entry.run_at = next_time;
old_entry.replace_key();
old_entry.insert_key(request.message);
clux marked this conversation as resolved.
Show resolved Hide resolved
}
Entry::Occupied(_old_entry) => {
RawEntryMut::Occupied(_old_entry) => {
// Old entry will run before the new request, so ignore the new request..
}
Entry::Vacant(entry) => {
RawEntryMut::Vacant(entry) => {
// No old entry, we're free to go!
let message = entry.key().clone();
entry.insert(ScheduledEntry {
let message = request.message.clone();
entry.insert(request.message, ScheduledEntry {
run_at: next_time,
queue_key: self.queue.insert_at(message, next_time),
});
Expand Down
Loading