Browse Source

Graceful shutdown

develop
Olivier 'reivilibre' 2 months ago
parent
commit
7560aefdd0
  1. 18
      yama/src/remote/responder.rs

18
yama/src/remote/responder.rs

@ -7,7 +7,7 @@ use std::thread::JoinHandle;
use anyhow::anyhow;
use crossbeam_channel::{Receiver, Sender};
use itertools::Itertools;
use log::{error, warn};
use log::{error, info, warn};
use crate::pile::RawPile;
use crate::remote::{read_message, write_message, Request, RequestBody, Response, ResponseBody};
@ -80,6 +80,11 @@ impl Responder {
let request: Request = read_message(&mut read)?;
match request.body {
RequestBody::Shutdown => {
worker_queue_send.send(request)?;
info!("Shutting down responder");
return Ok(());
}
RequestBody::NextBatch { token } => {
let tokens = self
.continuation_tokens
@ -277,13 +282,10 @@ impl Responder {
}
}
},
RequestBody::Shutdown => {
warn!("Not yet implemented: Shutdown");
Response {
response_to: request.id,
body: ResponseBody::Success,
}
}
RequestBody::Shutdown => Response {
response_to: request.id,
body: ResponseBody::Success,
},
};
responses

Loading…
Cancel
Save