add debug output
This commit is contained in:
parent
f6d86376d1
commit
c0ed026d89
|
@ -86,6 +86,7 @@ impl Feed {
|
||||||
.await?
|
.await?
|
||||||
.json()
|
.json()
|
||||||
.await?;
|
.await?;
|
||||||
|
println!("{} {} posts", url, posts.len());
|
||||||
Ok(Feed { posts })
|
Ok(Feed { posts })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,12 +36,14 @@ async fn main() {
|
||||||
.expect("reqwest::Client");
|
.expect("reqwest::Client");
|
||||||
|
|
||||||
let (posts_tx, posts_rx) = tokio::sync::mpsc::unbounded_channel();
|
let (posts_tx, posts_rx) = tokio::sync::mpsc::unbounded_channel();
|
||||||
|
println!("spawning");
|
||||||
trends::spawn(&config.redis, posts_rx).await;
|
trends::spawn(&config.redis, posts_rx).await;
|
||||||
|
println!("spawned");
|
||||||
|
|
||||||
let mut workers_active = 0usize;
|
let mut workers_active = 0usize;
|
||||||
let (message_tx, mut message_rx) = tokio::sync::mpsc::unbounded_channel();
|
let (message_tx, mut message_rx) = tokio::sync::mpsc::unbounded_channel();
|
||||||
loop {
|
loop {
|
||||||
// println!("{} workers active, queued {} of {}", workers_active, world.queue_len(), world.size());
|
println!("{} workers active, queued {} of {}", workers_active, world.queue_len(), world.size());
|
||||||
let next_task = if workers_active < config.max_workers {
|
let next_task = if workers_active < config.max_workers {
|
||||||
world.dequeue()
|
world.dequeue()
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -77,6 +77,14 @@ impl World {
|
||||||
self.queue.remove(&time)
|
self.queue.remove(&time)
|
||||||
.map(|host| Ok(host))
|
.map(|host| Ok(host))
|
||||||
.unwrap_or(Err(Duration::from_secs(1)))
|
.unwrap_or(Err(Duration::from_secs(1)))
|
||||||
|
.map(|host| {
|
||||||
|
if let Some(last_fetch) = self.instances.get(&host).and_then(|i| i.last_fetch) {
|
||||||
|
println!("Fetch {} - last before {:?}", host, now - last_fetch);
|
||||||
|
} else {
|
||||||
|
println!("Fetch {} - NEW", host);
|
||||||
|
}
|
||||||
|
host
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
Err(time - now)
|
Err(time - now)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user