Chore: Combine if statements

pull/4700/head
Nelson Chan 4 weeks ago
parent 2027f4949f
commit 83a5b61211
No known key found for this signature in database

@ -541,19 +541,17 @@ class Monitor extends BeanModel {
// fallback for if kelog event is not emitted, but we may still have tlsInfo, // fallback for if kelog event is not emitted, but we may still have tlsInfo,
// e.g. if the connection is made through a proxy // e.g. if the connection is made through a proxy
if (this.getUrl()?.protocol === "https:") { if (this.getUrl()?.protocol === "https:" && tlsInfo.valid === undefined) {
if (tlsInfo.valid === undefined) { const tlsSocket = res.request.res.socket;
const tlsSocket = res.request.res.socket;
if (tlsSocket) {
if (tlsSocket) { tlsInfo.valid = tlsSocket.authorized || false;
tlsInfo.valid = tlsSocket.authorized || false; tlsInfo = checkCertificate(tlsSocket);
tlsInfo = checkCertificate(tlsSocket); await this.updateTlsInfo(tlsInfo);
await this.updateTlsInfo(tlsInfo);
if (!this.getIgnoreTls() && this.isEnabledExpiryNotification()) {
if (!this.getIgnoreTls() && this.isEnabledExpiryNotification()) { log.debug("monitor", `[${this.name}] call checkCertExpiryNotifications`);
log.debug("monitor", `[${this.name}] call checkCertExpiryNotifications`); await this.checkCertExpiryNotifications(tlsInfo);
await this.checkCertExpiryNotifications(tlsInfo);
}
} }
} }
} }

Loading…
Cancel
Save