Artificially advance time on BridgeDb
This commit is contained in:
parent
766516cee3
commit
13d098eaa0
|
@ -415,6 +415,9 @@ impl LoxServerContext {
|
||||||
let mut ba_obj = self.ba.lock().unwrap();
|
let mut ba_obj = self.ba.lock().unwrap();
|
||||||
ba_obj.advance_days(num); // FOR TESTING ONLY
|
ba_obj.advance_days(num); // FOR TESTING ONLY
|
||||||
println!("Today's date according to server: {}", ba_obj.today());
|
println!("Today's date according to server: {}", ba_obj.today());
|
||||||
|
// Also advance days for BridgeDb
|
||||||
|
let mut db_obj = self.db.lock().unwrap();
|
||||||
|
db_obj.advance_days(num); // FOR TESTING ONLY
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encrypts the Lox bridge table, should be called after every sync
|
// Encrypts the Lox bridge table, should be called after every sync
|
||||||
|
|
|
@ -287,6 +287,17 @@ impl BridgeDb {
|
||||||
Err(SignatureError::new())
|
Err(SignatureError::new())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///#[cfg(test)]
|
||||||
|
/// For testing only: manually advance the day by the given number
|
||||||
|
/// of days
|
||||||
|
pub fn advance_days(&mut self, days: u16) {
|
||||||
|
if days > 0 {
|
||||||
|
self.today += Duration::days(days.into());
|
||||||
|
// Reset daily bridges distributed count
|
||||||
|
self.daily_bridges_distributed = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for BridgeDb {
|
impl Default for BridgeDb {
|
||||||
|
|
Loading…
Reference in New Issue