add debug output
This commit is contained in:
parent
f6d86376d1
commit
c0ed026d89
|
@ -86,6 +86,7 @@ impl Feed {
|
|||
.await?
|
||||
.json()
|
||||
.await?;
|
||||
println!("{} {} posts", url, posts.len());
|
||||
Ok(Feed { posts })
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,12 +36,14 @@ async fn main() {
|
|||
.expect("reqwest::Client");
|
||||
|
||||
let (posts_tx, posts_rx) = tokio::sync::mpsc::unbounded_channel();
|
||||
println!("spawning");
|
||||
trends::spawn(&config.redis, posts_rx).await;
|
||||
println!("spawned");
|
||||
|
||||
let mut workers_active = 0usize;
|
||||
let (message_tx, mut message_rx) = tokio::sync::mpsc::unbounded_channel();
|
||||
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 {
|
||||
world.dequeue()
|
||||
} else {
|
||||
|
|
|
@ -77,6 +77,14 @@ impl World {
|
|||
self.queue.remove(&time)
|
||||
.map(|host| Ok(host))
|
||||
.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 {
|
||||
Err(time - now)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue