Calling noop by run_command_and_check function instead of noop command, so that better is checked if the command executed correctly

This commit is contained in:
SanderBaan
2026-03-30 17:55:26 +02:00
parent 8804f50dde
commit af5c2f0bdc
+4 -1
View File
@@ -25,7 +25,10 @@ impl bb8::ManageConnection for ImapConnectionManager {
}
// call this function before using the connection
async fn is_valid(&self, conn: &mut Self::Connection) -> RustMailerResult<()> {
match tokio::time::timeout(Duration::from_secs(5), conn.noop()).await {
if conn.is_bad {
return Err(raise_error!(format!("Connection marked broken"), ErrorCode::ImapCommandFailed));
}
match tokio::time::timeout(Duration::from_secs(5), conn.run_command_and_check_ok("NOOP")).await {
Ok(Ok(_)) => Ok(()),
Ok(Err(e)) => {
error!("IMAP connection validation failed: {:?}", e);