Skip to content

Commit

Permalink
remove fwd_chain
Browse files Browse the repository at this point in the history
  • Loading branch information
djmitche committed Jan 21, 2024
1 parent d22e39a commit f95bbe8
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions taskchampion/taskchampion/src/server/cloud/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,11 @@ impl<SVC: Service> CloudServer<SVC> {

// Create chains mapping forward (parent -> child) and backward (child -> parent), starting
// at "latest".
let mut fwd_chain = HashMap::new();
let mut rev_chain = HashMap::new();
let mut iterations = versions.len() + 1; // For cycle detection.
let latest = self.get_latest()?;
if let Some(mut c) = latest {
while let Some(p) = parent_of(c) {
fwd_chain.insert(p, c);
rev_chain.insert(c, p);
c = p;
iterations -= 1;
Expand Down Expand Up @@ -271,7 +269,7 @@ impl<SVC: Service> CloudServer<SVC> {
// may be in the state where it has uploaded a version but not changed "latest" yet,
// so any pair with parent equal to latest is allowed to stay.
for (c, p, _) in versions {
if fwd_chain.get(&p) != Some(&c) && Some(p) != latest {
if rev_chain.get(&c) != Some(&p) && Some(p) != latest {
self.service.del(&Self::version_name(&p, &c))?;
}
}
Expand Down

0 comments on commit f95bbe8

Please sign in to comment.