Introduce a digest epoch
All checks were successful
/ build (push) Successful in 1m4s

To add a mechanism for updating all issue comments after a code change,
introduce a HASH_EPOCH constant which gets mixed into the stable hash
for each issue.  Changing this value will force all issue comments to be
updated.
This commit is contained in:
Rahix 2025-10-05 18:59:47 +02:00
parent da085da38f
commit 77d7d3aef6

View file

@ -2,6 +2,8 @@ use std::collections::BTreeMap;
use petgraph::visit::EdgeRef as _; use petgraph::visit::EdgeRef as _;
const HASH_EPOCH: u32 = 0x00000001;
/// Element in the techtree /// Element in the techtree
#[derive(Debug, Clone, Hash, PartialEq, Eq, serde::Serialize)] #[derive(Debug, Clone, Hash, PartialEq, Eq, serde::Serialize)]
pub struct Element { pub struct Element {
@ -420,7 +422,7 @@ impl<'a> Subtree<'a> {
.collect(); .collect();
edges.sort(); edges.sort();
let json_data = serde_json::ser::to_string(&(nodes, edges)).unwrap(); let json_data = serde_json::ser::to_string(&(nodes, edges, HASH_EPOCH)).unwrap();
sha256::digest(json_data) sha256::digest(json_data)
} }
} }