Clear the dkim_works data when authservid candidates change

This commit is contained in:
Hocuri
2022-10-14 14:26:26 +02:00
parent feee7aee3d
commit f0efff2c99

View File

@@ -156,6 +156,10 @@ async fn update_authservid_candidates(
context context
.set_config(Config::AuthservidCandidates, Some(&new_config)) .set_config(Config::AuthservidCandidates, Some(&new_config))
.await?; .await?;
// Updating the authservid candidates may mean that we now consider
// emails as "failed" which "passed" previously, so we need to
// reset our expectation which DKIMs work.
clear_dkim_works(context).await?
} }
Ok(()) Ok(())
} }
@@ -235,6 +239,14 @@ async fn set_dkim_works(context: &Context, from_domain: &str) -> Result<()> {
Ok(()) Ok(())
} }
async fn clear_dkim_works(context: &Context) -> Result<()> {
context
.sql
.execute("DELETE FROM sending_domains", paramsv![])
.await?;
Ok(())
}
fn parse_authservid_candidates_config(config: &Option<String>) -> HashSet<&str> { fn parse_authservid_candidates_config(config: &Option<String>) -> HashSet<&str> {
config config
.as_deref() .as_deref()