Info Logging Bugfix
All checks were successful
Run Tests on Code / run-tests (push) Successful in 0s
All checks were successful
Run Tests on Code / run-tests (push) Successful in 0s
This commit is contained in:
parent
3badff94ec
commit
608a3bbdeb
2 changed files with 8 additions and 6 deletions
|
@ -64,7 +64,7 @@ pub(crate) async fn run(data: Arc<RwLock<SharedData>>) {
|
|||
|
||||
write.start = Utc::now();
|
||||
|
||||
if write.start - last_reload > Duration::seconds(write.config.config_reload_seconds as i64) {
|
||||
if write.start - last_reload >= Duration::seconds(write.config.config_reload_seconds as i64) {
|
||||
write.config = match Config::load() {
|
||||
Ok(data) => data,
|
||||
Err(e) => panic!("{}", e),
|
||||
|
@ -91,7 +91,7 @@ pub(crate) async fn run(data: Arc<RwLock<SharedData>>) {
|
|||
|
||||
{
|
||||
let read = data.read().await;
|
||||
if read.start - last_reload > Duration::seconds(read.config.config_reload_seconds as i64) {
|
||||
if read.start - last_reload >= Duration::seconds(read.config.config_reload_seconds as i64) {
|
||||
communities = match lemmy.get_communities().await {
|
||||
Ok(data) => data,
|
||||
Err(e) => {
|
||||
|
@ -102,6 +102,7 @@ pub(crate) async fn run(data: Arc<RwLock<SharedData>>) {
|
|||
continue
|
||||
}
|
||||
};
|
||||
drop(read);
|
||||
let mut write = data.write().await;
|
||||
write.messages.push(Message::Info("Communities reloaded".to_string()));
|
||||
last_reload = Utc::now();
|
||||
|
|
|
@ -27,12 +27,13 @@ async fn print_info<'a>(data: RwLockReadGuard<'a, SharedData>, min_len_series: &
|
|||
Utc::now().naive_local().format("%H:%M:%S")
|
||||
);
|
||||
println!("Instance: {}", data.config.instance);
|
||||
println!(
|
||||
"Ran Last: {}",
|
||||
print!(
|
||||
"Ran Last: {} | Config Reload Interval: {}",
|
||||
data
|
||||
.start
|
||||
.naive_local()
|
||||
.format("%d/%m/%Y %H:%M:%S")
|
||||
.format("%d/%m/%Y %H:%M:%S"),
|
||||
data.config.config_reload_seconds
|
||||
);
|
||||
println!("{:#<1$}", "", separator_width);
|
||||
data.post_history.series.iter().for_each(|(series, post_history)| {
|
||||
|
@ -82,7 +83,7 @@ async fn print_info<'a>(data: RwLockReadGuard<'a, SharedData>, min_len_series: &
|
|||
println!("{}", error.content());
|
||||
}
|
||||
println!("{:#<1$}", "", separator_width);
|
||||
for message in data.get_messages(false, false, false).iter() {
|
||||
for message in data.get_messages(false, false, true).iter() {
|
||||
println!("{}", message.content());
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue