Removes stale data before doing repopulation

This probably is only an issue when there are very few users, like my
test instance
This commit is contained in:
Mouse Reeve
2021-08-02 18:14:44 -07:00
parent 01334b6613
commit df9787dd7a
2 changed files with 14 additions and 1 deletions

View File

@ -65,6 +65,10 @@ class RedisStore(ABC):
pipeline = r.pipeline()
queryset = self.get_objects_for_store(store)
# first, remove everything currently in it
pipeline.delete(store)
# now, add everything back
for obj in queryset[: self.max_length]:
pipeline.zadd(store, self.get_value(obj))