Skip to content

Commit

Permalink
More logging
Browse files Browse the repository at this point in the history
  • Loading branch information
vv9k committed Dec 7, 2021
1 parent 50ad18a commit c479b59
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/worker/events/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ impl EventsWorker {
event = event_stream.next() => {
match event {
Some(Ok(event)) => {
log::trace!("adding event");
self.sys_events.push(event);
}
Some(Err(e)) => {
Expand Down
9 changes: 7 additions & 2 deletions src/worker/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ impl DockerWorker {
rx_req,
tx_rsp,
} = self;
trace!("starting work");
// used to transfer requests between the listener task and the worker task
let (inner_tx_req, inner_rx_req) = mpsc::channel::<EventRequest>(64);

Expand All @@ -72,12 +73,14 @@ impl DockerWorker {
docker_addr: String,
rx_req: mpsc::Receiver<EventRequest>,
tx_rsp: mpsc::Sender<EventResponse>,
) {
) -> std::thread::JoinHandle<Result<()>> {
trace!("spawning worker thread for {}", docker_addr);
std::thread::spawn(move || -> Result<()> {
let worker = DockerWorker::new(docker_addr, rx_req, tx_rsp)?;
trace!("got worker {}", &worker.uri);

runtime.block_on(worker.work())
});
})
}
}

Expand All @@ -86,6 +89,7 @@ async fn listener_task(
mut rx_req: mpsc::Receiver<EventRequest>,
inner_tx_req: mpsc::Sender<EventRequest>,
) {
trace!("starting listener task");
loop {
if let Some(req) = rx_req.recv().await {
debug!("[listener] got request: {:?}", req);
Expand All @@ -102,6 +106,7 @@ async fn inner_work(
mut inner_rx_req: mpsc::Receiver<EventRequest>,
tx_rsp: mpsc::Sender<EventResponse>,
) {
trace!("starting worker task");
if let Err(e) = docker.adjust_api_version().await {
error!("failed to adjust docker API version: {}", e);
}
Expand Down

0 comments on commit c479b59

Please sign in to comment.