Abhilash Raj pushed to branch master at GNU Mailman / Mailman Core
Commits: 07d18d22 by ashryaagr at 2019-04-25T05:12:22Z Calculate expired entries in database query. Thanks to Ashrya Agrawal for the contribution. - - - - - 2 changed files: - src/mailman/docs/NEWS.rst - src/mailman/model/cache.py Changes: ===================================== src/mailman/docs/NEWS.rst ===================================== @@ -32,6 +32,8 @@ Other ----- * Add a new attribute ``tag`` to ``HeaderMatch`` to find and manage a set of rules. (See !497) +* Expired cached entries will be deleted efficiently. (Closes #462) + 3.2.2 ===== ===================================== src/mailman/model/cache.py ===================================== @@ -156,11 +156,13 @@ class CacheManager: # Find all the cache entries which have expired. We can probably do # this more efficiently, but for now there probably aren't that many # cached files. - for entry in store.query(CacheEntry): - if entry.is_expired: - file_path, dir_path = self._id_to_path(entry.file_id) - os.remove(file_path) - store.delete(entry) + expired_entries = (store.query(CacheEntry) + .filter(CacheEntry.expires_on <= now()) + .all()) + for entry in expired_entries: + file_path, _ = self._id_to_path(entry.file_id) + os.remove(file_path) + store.delete(entry) @dbconnection def clear(self, store): View it on GitLab: https://gitlab.com/mailman/mailman/commit/07d18d22f8fc572c7ac4a1c23c3d27bcad667a9c -- View it on GitLab: https://gitlab.com/mailman/mailman/commit/07d18d22f8fc572c7ac4a1c23c3d27bcad667a9c You're receiving this email because of your account on gitlab.com.
_______________________________________________ Mailman-checkins mailing list Mailman-checkins@python.org Unsubscribe: https://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org