mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2025-07-08 04:30:02 +02:00
Set age dynamically #504
This commit is contained in:
parent
c29197b3f4
commit
5182a7e38f
1 changed files with 5 additions and 1 deletions
|
@ -116,7 +116,11 @@ impl PduEvent {
|
|||
.map_or_else(|| Ok(BTreeMap::new()), |u| serde_json::from_str(u.get()))
|
||||
.map_err(|_| Error::bad_database("Invalid unsigned in pdu event"))?;
|
||||
|
||||
unsigned.insert("age".to_owned(), to_raw_value(&1).unwrap());
|
||||
let now: u64 = MilliSecondsSinceUnixEpoch::now().get().into();
|
||||
let then: u64 = self.origin_server_ts.into();
|
||||
let this_age: u64 = now - then;
|
||||
|
||||
unsigned.insert("age".to_owned(), to_raw_value(&this_age).unwrap());
|
||||
self.unsigned = Some(to_raw_value(&unsigned).expect("unsigned is valid"));
|
||||
|
||||
Ok(())
|
||||
|
|
Loading…
Add table
Reference in a new issue