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 /target
/examples /examples
/.idea
relays relays
keys keys
*.html *.html

View File

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

View File

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