Fix logging messages

This commit is contained in:
Edward Shen 2021-05-27 16:22:15 -04:00
parent c32e534300
commit f038452263
Signed by: edward
GPG key ID: 19182661E818369F
3 changed files with 6 additions and 5 deletions

View file

@ -176,9 +176,10 @@ pub async fn update_server_state(secret: &str, cli: &CliArgs, data: &mut Arc<RwL
debug!("got write guard for server state");
let mut write_guard = data.0.write();
if !write_guard.url_overridden && write_guard.image_server != resp.image_server {
let image_server_changed = write_guard.image_server != resp.image_server;
if !write_guard.url_overridden && image_server_changed {
write_guard.image_server = resp.image_server;
} else {
} else if image_server_changed {
warn!("Ignoring new upstream url!");
}
@ -220,7 +221,7 @@ pub async fn update_server_state(secret: &str, cli: &CliArgs, data: &mut Arc<RwL
PREVIOUSLY_COMPROMISED.store(resp.compromised, Ordering::Release);
if resp.compromised {
error!("Got compromised response from control center!");
} else {
} else if previously_compromised {
info!("No longer compromised!");
}
}

View file

@ -11,7 +11,7 @@ use actix_web::{get, web::Data, HttpRequest, HttpResponse, Responder};
use base64::DecodeError;
use bytes::Bytes;
use chrono::{DateTime, Utc};
use futures::{AsyncReadExt, Stream, TryStreamExt};
use futures::{Stream, TryStreamExt};
use log::{debug, error, info, warn};
use once_cell::sync::Lazy;
use prometheus::{Encoder, TextEncoder};

View file

@ -75,7 +75,7 @@ impl ServerState {
}
})?;
PREVIOUSLY_COMPROMISED.store(resp.paused, Ordering::Release);
PREVIOUSLY_COMPROMISED.store(resp.compromised, Ordering::Release);
if resp.compromised {
error!("Got compromised response from control center!");
}