Skip to content

Commit

Permalink
Playlist status: Don't overwrite playlist timestamp with older date
Browse files Browse the repository at this point in the history
the playlists are sorted by date descending, so currently older playlist (processed last) have older created dates and overwrite newer ones, making that datapoint pretty useless
  • Loading branch information
MonkeyDo committed Dec 13, 2024
1 parent 6f38d94 commit 403218c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions listenbrainz/webserver/views/status_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ def get_playlists_timestamp():
return last_updated
for playlist in playlists:
source_patch = playlist.additional_metadata["algorithm_metadata"]["source_patch"]
if source_patch in last_updated:
# playlists are sorted by created date in descending order
# don't overwrite the previously set timestamp for that playlist patch
continue
last_updated_ts = int(playlist.last_updated.timestamp())
last_updated[source_patch] = last_updated_ts
cache.set(cache_key, last_updated, PLAYLIST_CACHE_TIME)
Expand Down

0 comments on commit 403218c

Please sign in to comment.