mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-24 03:30:50 +02:00
expiration date written to db on fetch_cache
This commit is contained in:
parent
ebafb31f70
commit
441a6027ba
3 changed files with 15 additions and 3 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue