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