Skip to content

Commit

Permalink
stats: log skipped update
Browse files Browse the repository at this point in the history
This makes it easier to debug if stats was ommitted or has a future
timestamp.

See #10473
  • Loading branch information
nijel committed Nov 28, 2023
1 parent 2f1d417 commit 67ee5ba
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions weblate/utils/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ def __init__(self, obj):
self.last_change_cache = None
self._collected_update_objects = None

def __repr__(self):
return f"<{self.__class__.__name__}:{self.cache_key}>"

@property
def pk(self):
return self._object.pk
Expand Down Expand Up @@ -302,11 +305,10 @@ def update_parents(self, *, extra_objects: list[BaseStats] | None = None):
"""Update parent statistics."""
for stat in self._iterate_update_objects(extra_objects=extra_objects):
if self.stats_timestamp and self.stats_timestamp <= stat.stats_timestamp:
continue
self._object.log_debug(
"updating %s (%s)", stat.__class__.__name__, stat._object
)
stat.update_stats()
self._object.log_debug("skipping update of %s", stat)
else:
self._object.log_debug("updating stats %s", stat)
stat.update_stats()

def clear(self):
"""Clear local cache."""
Expand Down

0 comments on commit 67ee5ba

Please sign in to comment.