flush endpoint
This commit is contained in:
parent
5b5ce1995a
commit
3041858b99
1 changed files with 7 additions and 0 deletions
|
@ -101,6 +101,7 @@ async fn main() -> Result<(), Error> {
|
||||||
.route("/turtle/new", post(create_turtle))
|
.route("/turtle/new", post(create_turtle))
|
||||||
.route("/turtle/update/:id", post(command))
|
.route("/turtle/update/:id", post(command))
|
||||||
.route("/turtle/client.lua", get(client))
|
.route("/turtle/client.lua", get(client))
|
||||||
|
.route("/flush", get(flush))
|
||||||
.with_state(state.clone());
|
.with_state(state.clone());
|
||||||
|
|
||||||
let listener = tokio::net::TcpListener::bind("0.0.0.0:48228").await.unwrap();
|
let listener = tokio::net::TcpListener::bind("0.0.0.0:48228").await.unwrap();
|
||||||
|
@ -163,6 +164,12 @@ async fn write_to_disk(state: SharedControl) -> anyhow::Result<()> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async fn flush(State(state): State<SharedControl>) -> &'static str {
|
||||||
|
write_to_disk(state).await.unwrap();
|
||||||
|
|
||||||
|
"ACK"
|
||||||
|
}
|
||||||
|
|
||||||
async fn shutdown_signal() {
|
async fn shutdown_signal() {
|
||||||
let ctrl_c = async {
|
let ctrl_c = async {
|
||||||
signal::ctrl_c()
|
signal::ctrl_c()
|
||||||
|
|
Loading…
Reference in a new issue