From cfea768f4d57af2e330d033d1a882e12aba6cebe Mon Sep 17 00:00:00 2001 From: Mark Sapiro Date: Fri, 10 May 2024 16:48:15 -0700 Subject: [PATCH] Add configuration for dsn lifetime in message store. --- src/mailman/config/schema.cfg | 5 +++++ src/mailman/docs/NEWS.rst | 2 ++ src/mailman/model/bounce.py | 4 ++-- src/mailman/rest/docs/systemconf.rst | 1 + src/mailman/rest/tests/test_systemconf.py | 1 + 5 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/mailman/config/schema.cfg b/src/mailman/config/schema.cfg index 229e9f1e1..cc982bbd6 100644 --- a/src/mailman/config/schema.cfg +++ b/src/mailman/config/schema.cfg @@ -66,6 +66,11 @@ pending_request_life: 3d # is for user confirmations. moderator_request_life: 180d +# Default lifetime of saved bounce DSNs. This doesn't need to be long. +# They only need to be saved so they can be attached to admin notices which +# are normally sent immediately, but by an asynchronous process. +dsn_lifetime: 1d + # How long should files be saved before they are evicted from the cache? cache_life: 7d diff --git a/src/mailman/docs/NEWS.rst b/src/mailman/docs/NEWS.rst index 73585b1b3..7241fb792 100644 --- a/src/mailman/docs/NEWS.rst +++ b/src/mailman/docs/NEWS.rst @@ -48,6 +48,8 @@ New Features * Set process title if setproctitle module is available. (Closes #1134) * Strip whitespaces from Message-ID header value in log not to separate into multiple lines (Closes #1139) +* The lifetime of saved DSNs in the message store is now configurable with a + default of 1 day. (Closes #1145) Other ----- diff --git a/src/mailman/model/bounce.py b/src/mailman/model/bounce.py index 7798a332f..3065fe61e 100644 --- a/src/mailman/model/bounce.py +++ b/src/mailman/model/bounce.py @@ -22,7 +22,7 @@ import datetime from email.utils import make_msgid from lazr.config import as_boolean, as_timedelta -from mailman.app.bounces import _ProbePendable, PENDABLE_LIFETIME, send_probe +from mailman.app.bounces import _ProbePendable, send_probe from mailman.app.membership import delete_member from mailman.app.notifications import ( send_admin_disable_notice, @@ -104,7 +104,7 @@ class BounceProcessor: pendable = _ProbePendable( _mod_message_id=msg.get('message-id')) getUtility(IPendings).add( - pendable, lifetime=as_timedelta(PENDABLE_LIFETIME)) + pendable, lifetime=as_timedelta(config.mailman.dsn_lifetime)) event = BounceEvent(mlist.list_id, email, msg, where) store.add(event) return event diff --git a/src/mailman/rest/docs/systemconf.rst b/src/mailman/rest/docs/systemconf.rst index 84b3aac48..f197c1aa0 100644 --- a/src/mailman/rest/docs/systemconf.rst +++ b/src/mailman/rest/docs/systemconf.rst @@ -20,6 +20,7 @@ You can also get all the values for a particular section, such as the cache_life: 7d check_max_size_on_filtered_message: no default_language: en + dsn_lifetime: 1d email_commands_max_lines: 10 filter_report: no filtered_messages_are_preservable: no diff --git a/src/mailman/rest/tests/test_systemconf.py b/src/mailman/rest/tests/test_systemconf.py index 66b835a68..07727db5f 100644 --- a/src/mailman/rest/tests/test_systemconf.py +++ b/src/mailman/rest/tests/test_systemconf.py @@ -43,6 +43,7 @@ class TestSystemConfiguration(unittest.TestCase): cache_life='7d', check_max_size_on_filtered_message='no', default_language='en', + dsn_lifetime='1d', email_commands_max_lines='10', filter_report='no', filtered_messages_are_preservable='no', -- 2.11.4.GIT