Skip to content

Commit

Permalink
[refactoring] Counter hash impl
Browse files Browse the repository at this point in the history
  • Loading branch information
didierofrivia committed Jun 26, 2023
1 parent 1452117 commit 8cc4b35
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions limitador/src/counter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,10 @@ impl Hash for Counter {
fn hash<H: Hasher>(&self, state: &mut H) {
self.limit.hash(state);

let mut encoded_vars = self
.set_variables
.iter()
.map(|(k, v)| k.to_owned() + ":" + v)
.collect::<Vec<String>>();

encoded_vars.sort();
encoded_vars.hash(state);
self.set_variables.iter().for_each(|(k, v)| {
k.hash(state);
v.hash(state);
});
}
}

Expand Down

0 comments on commit 8cc4b35

Please sign in to comment.