expiration date written to db on fetch_cache

This commit is contained in:
David Kennedy 2023-11-22 17:41:27 -05:00
parent ebafb31f70
commit 441a6027ba
No known key found for this signature in database
GPG key ID: 6528A5386E66B96B
3 changed files with 15 additions and 3 deletions

View file

@ -214,9 +214,7 @@ class Domain(TimeStampedModel, DomainHelper):
"""Get or set the `ex_date` element from the registry.
Additionally, update the expiration date in the registrar"""
try:
self.expiration_date = self._get_property("ex_date")
self.save()
return self.expiration_date
return self._get_property("ex_date")
except Exception as e:
# exception raised during the save to registrar
logger.error(f"error updating expiration date in registrar: {e}")
@ -1602,6 +1600,12 @@ class Domain(TimeStampedModel, DomainHelper):
if old_cache_contacts is not None:
cleaned["contacts"] = old_cache_contacts
# if expiration date from registry does not match what is in db,
# update the db
if "ex_date" in cleaned and cleaned["ex_date"] != self.expiration_date:
self.expiration_date = cleaned["ex_date"]
self.save()
self._cache = cleaned
except RegistryError as e: