Do not need to fetch all archives when checking if domain has archives.

This commit is contained in:
Roland 2023-09-12 17:49:17 -06:00
parent a8143d81b1
commit 17b3923747
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93

View file

@ -93,8 +93,10 @@ class Archive(Base, ModelHelper):
session.delete(self)
if self.domain:
domain_archives = [i.id for i in self.domain.archives]
if not domain_archives:
# Delete a domain if it has no Archives.
try:
next(i.id for i in self.domain.archives)
except StopIteration:
self.domain.delete()
@property