Skip to content

Commit

Permalink
OpenConceptLab/ocl_issues#857 Frequent 504 gateway timeout when reque…
Browse files Browse the repository at this point in the history
…sting exports on staging
  • Loading branch information
rkorytkowski committed Jul 30, 2021
1 parent 187b652 commit 8a7f4c1
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions core/common/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,17 +362,21 @@ def active_mappings(self):

@property
def last_concept_update(self):
updated_at = None
if self.concepts.exists():
updated_at = self.concepts.only('updated_at').latest('updated_at').updated_at
return updated_at
# Use 'values_list' instead of 'first' so as not load any concepts...
updated_at = self.concepts.order_by('updated_at').values_list('updated_at', flat=True)[:1]
if updated_at:
return updated_at[0]

return None

@property
def last_mapping_update(self):
updated_at = None
if self.mappings.exists():
updated_at = self.mappings.only('updated_at').latest('updated_at').updated_at
return updated_at
# Use 'values_list' instead of 'first' so as not load any concepts...
updated_at = self.mappings.order_by('updated_at').values_list('updated_at', flat=True)[:1]
if updated_at:
return updated_at[0]

return None

@property
def last_child_update(self):
Expand Down

0 comments on commit 8a7f4c1

Please sign in to comment.