mirror of
https://github.com/ArchiveBox/ArchiveBox
synced 2024-11-10 14:44:18 +00:00
speed up latest_title by preferring db title if present
This commit is contained in:
parent
8b236b9367
commit
1e2188517b
1 changed files with 9 additions and 0 deletions
|
@ -169,11 +169,20 @@ class Snapshot(models.Model):
|
|||
|
||||
@cached_property
|
||||
def latest_title(self):
|
||||
if self.title:
|
||||
return self.title
|
||||
|
||||
try:
|
||||
return self.archiveresult_set.filter(extractor='title', status='succeeded')[0].output
|
||||
except ArchiveResult.DoesNotExist:
|
||||
pass
|
||||
|
||||
if ('title' in self.history
|
||||
and self.history['title']
|
||||
and (self.history['title'][-1].status == 'succeeded')
|
||||
and self.history['title'][-1].output.strip()):
|
||||
return self.history['title'][-1].output.strip()
|
||||
|
||||
return None
|
||||
|
||||
def save_tags(self, tags=()):
|
||||
|
|
Loading…
Reference in a new issue