Skip to content

Commit c6a2b95

Browse files
authored
fix: change the task ID generation order in id_generator to apply revision before piece_length (#1714)
Signed-off-by: Gaius <gaius.qi@gmail.com>
1 parent f38ce30 commit c6a2b95

File tree

3 files changed

+25
-23
lines changed

3 files changed

+25
-23
lines changed

Cargo.lock

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ members = [
1313
]
1414

1515
[workspace.package]
16-
version = "1.2.14"
16+
version = "1.2.15"
1717
authors = ["The Dragonfly Developers"]
1818
homepage = "https://d7y.io/"
1919
repository = "https://github.com/dragonflyoss/client.git"
@@ -23,14 +23,14 @@ readme = "README.md"
2323
edition = "2021"
2424

2525
[workspace.dependencies]
26-
dragonfly-client = { path = "dragonfly-client", version = "1.2.14" }
27-
dragonfly-client-core = { path = "dragonfly-client-core", version = "1.2.14" }
28-
dragonfly-client-config = { path = "dragonfly-client-config", version = "1.2.14" }
29-
dragonfly-client-storage = { path = "dragonfly-client-storage", version = "1.2.14" }
30-
dragonfly-client-backend = { path = "dragonfly-client-backend", version = "1.2.14" }
31-
dragonfly-client-metric = { path = "dragonfly-client-metric", version = "1.2.14" }
32-
dragonfly-client-util = { path = "dragonfly-client-util", version = "1.2.14" }
33-
dragonfly-client-init = { path = "dragonfly-client-init", version = "1.2.14" }
26+
dragonfly-client = { path = "dragonfly-client", version = "1.2.15" }
27+
dragonfly-client-core = { path = "dragonfly-client-core", version = "1.2.15" }
28+
dragonfly-client-config = { path = "dragonfly-client-config", version = "1.2.15" }
29+
dragonfly-client-storage = { path = "dragonfly-client-storage", version = "1.2.15" }
30+
dragonfly-client-backend = { path = "dragonfly-client-backend", version = "1.2.15" }
31+
dragonfly-client-metric = { path = "dragonfly-client-metric", version = "1.2.15" }
32+
dragonfly-client-util = { path = "dragonfly-client-util", version = "1.2.15" }
33+
dragonfly-client-init = { path = "dragonfly-client-init", version = "1.2.15" }
3434
dragonfly-api = "=2.2.24"
3535
thiserror = "2.0"
3636
futures = "0.3.32"

dragonfly-client-util/src/id_generator/mod.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,15 +159,17 @@ impl IDGenerator {
159159
hasher.update(application);
160160
}
161161

162+
// Add the revision to generate the task id for the artifact with the same url but
163+
// different revisions, such as git repository.
164+
if let Some(revision) = revision {
165+
hasher.update(revision);
166+
}
167+
162168
// Add the piece length to generate the task id.
163169
if let Some(piece_length) = piece_length {
164170
hasher.update(piece_length.to_string());
165171
}
166172

167-
if let Some(revision) = revision {
168-
hasher.update(revision);
169-
}
170-
171173
hasher.update(TaskType::Standard.as_str_name().as_bytes());
172174

173175
// Generate the task id.
@@ -313,7 +315,7 @@ mod tests {
313315
filtered_query_params: vec![],
314316
revision: Some("v1.0".to_string()),
315317
},
316-
"91a1996a00d8ba39f7fecada21a7e24d0bde597842e5cb436ea99f77eca88a21",
318+
"5844f27a257287e9b734256bb25603d8005422ced8c0377f15063ec11963b25f",
317319
),
318320
(
319321
IDGenerator::new("127.0.0.1".to_string(), "localhost".to_string(), false),

0 commit comments

Comments
 (0)