feat: do not send notification when notify token is empty

This commit is contained in:
2020-10-15 08:37:30 +08:00
parent f2ad55691c
commit e9fdb60a80
3 changed files with 6 additions and 2 deletions

View File

@@ -170,6 +170,10 @@ fn keep_runningd(keep_running_config: Arc<KeepRunningConfig>) {
}
async fn send_notify(notify_token: &str, text: &str) {
if notify_token.is_empty() {
info!("Notify token is empty, do not send DingTalk notification");
return;
}
match DingTalk::from_token(&notify_token) {
Err(err) => error!("Prepare DingTalk error: {}", err),
Ok(dt) => if let Err(err) = dt.send_text(text).await {