diff --git a/src/coulobre/mail_node_routing.py b/src/coulobre/mail_node_routing.py index 9c3eb02..031e795 100644 --- a/src/coulobre/mail_node_routing.py +++ b/src/coulobre/mail_node_routing.py @@ -146,6 +146,7 @@ def reconcile_routes(records, *, retired=None): return previous = read_table() recipients = managed_recipients(records) + pruned = None if retired is not None and retired.domain in routes: spec = routes[retired.domain] if any( @@ -166,6 +167,7 @@ def reconcile_routes(records, *, retired=None): spec = MailRouting(spec.domain, aliases, catchall) else: spec = MailRouting(spec.domain, {}) - routes[spec.domain] = spec - save_policy(spec) + routes[spec.domain] = pruned = spec publish_routes(routes, recipients, previous) + if pruned is not None: + save_policy(pruned)