style: various small cleanups

This commit is contained in:
xeruf 2024-08-21 12:31:29 +03:00
parent 999068bdd9
commit f240413e2a
4 changed files with 7 additions and 6 deletions

1
.gitignore vendored
View File

@ -1,6 +1,7 @@
/target
/examples
/.idea
relays
keys
*.html

View File

@ -1,4 +1,3 @@
use std::io::{stdin, stdout, Write};
use std::ops::Sub;
use chrono::{DateTime, Local, TimeDelta, TimeZone, Utc};

View File

@ -156,7 +156,7 @@ async fn main() -> Result<()> {
} else {
let mut builder = colog::default_builder();
builder.filter(Some("nostr-relay-pool"), LevelFilter::Error);
//.filter(Some("nostr-relay-pool::relay::internal"), LevelFilter::Off)
//.filter(Some("nostr-relay-pool::relay::internal"), LevelFilter::Off)
builder
}.write_style(WriteStyle::Always).target(Target::Pipe(Box::new(rl.get_printer()))).init();
@ -319,8 +319,8 @@ async fn main() -> Result<()> {
loop {
trace!("All Root Tasks:\n{}", relays.iter().map(|(url, tasks)|
format!("{}: [{}]",
url.as_ref().map(ToString::to_string).unwrap_or(LOCAL_RELAY_NAME.to_string()),
format!("{}: [{}]",
url.as_ref().map(ToString::to_string).unwrap_or(LOCAL_RELAY_NAME.to_string()),
tasks.children_of(None).map(|id| tasks.get_task_title(id)).join("; "))).join("\n"));
println!();
let tasks = relays.get(&selected_relay).unwrap();
@ -546,6 +546,7 @@ async fn main() -> Result<()> {
let (label, times) = tasks.times_tracked();
println!("{}\n{}", label.italic(), times.rev().take(15).join("\n"));
}
// TODO show history from author / pubkey
} else {
let (label, mut times) = tasks.times_tracked();
println!("{}\n{}", label.italic(), times.join("\n"));
@ -559,7 +560,7 @@ async fn main() -> Result<()> {
Some(arg) => {
if parse_tracking_stamp(arg).map(|stamp| tasks.track_at(stamp, None)).is_none() {
// So the error message is not covered up
continue
continue;
}
}
}

View File

@ -396,7 +396,7 @@ impl Tasks {
let mut tracking_stamp: Option<Timestamp> = None;
for elem in
timestamps(self.history.get(&self.sender.pubkey()).into_iter().flatten(), &vec![t.get_id()])
.map(|(e, o)| e) {
.map(|(e, _)| e) {
if tracking_stamp.is_some() && elem > now {
break;
}