Improve cleanup logic
This commit is contained in:
@@ -74,12 +74,15 @@ def cleanup_expired(app):
|
||||
f"zone={hostname.zone} type=AAAA error={e}"
|
||||
)
|
||||
|
||||
if not (ipv4_deleted or ipv6_deleted):
|
||||
continue
|
||||
|
||||
if app.email_service:
|
||||
app.email_service.send_expiry_notification(
|
||||
hostname.user.email,
|
||||
hostname,
|
||||
ipv4_expired,
|
||||
ipv6_expired
|
||||
ipv4_deleted,
|
||||
ipv6_deleted
|
||||
)
|
||||
|
||||
# Clear IP addresses only if DNS delete succeeded
|
||||
@@ -88,7 +91,6 @@ def cleanup_expired(app):
|
||||
if ipv6_deleted:
|
||||
hostname.last_ipv6 = None
|
||||
|
||||
if ipv4_deleted or ipv6_deleted:
|
||||
hostname.save()
|
||||
expired_count += 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user