Skip to content

Upgrade to hashbrown 0.15.0 #1597

@clux

Description

@clux

Failed CI in #1591 at kube-runtime with:

error[E0599]: no method named `replace_key` found for struct `hashbrown::hash_map::OccupiedEntry` in the current scope
  --> kube-runtime/src/scheduler.rs:90:27
   |
90 |                 old_entry.replace_key();
   |                           ^^^^^^^^^^^ method not found in `OccupiedEntry<'_, T, ScheduledEntry>`

as a result of them reworking their Entry api: rust-lang/hashbrown#535

author there suggests the entry_ref api. looked at it for 1m and it didn't look immediately obvious so have left this issue here for now.

Need to update this usage here:

match self.scheduled.entry(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 => {
// 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();
}
Entry::Occupied(_old_entry) => {
// Old entry will run before the new request, so ignore the new request..
}
Entry::Vacant(entry) => {
// No old entry, we're free to go!
let message = entry.key().clone();
entry.insert(ScheduledEntry {
run_at: next_time,
queue_key: self.queue.insert_at(message, next_time),
});
}
}

which makes us able to use the same hashbrown version everywhere (and we can kill this instruction with wrong comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    dependenciesupgrades to dependencieshelp wantedNot immediately prioritised, please help!runtimecontroller runtime related

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions