On 6/26/23 10:27 PM, Ken Alker wrote:
So is the only thing stored in var/messages/ the held messages, and nothing more?
Two kinds of messages are in the message store. They are messages which are held for moderator action and bounce DSN messages.
Held messages should be removed from the message store when they are handled by a moderator. If there are no held messages in Postorius for any list, any in the message store can be safely removed.
Bounce DSNs are only needed for a very short time. They are saved when a bounce is received and removed after a few days by the task runner, but they are only needed until they are attached to the admin notice which happens within minutes, and this was only implemented in Mailman 3.3.5. Prior to that bounce DSNs weren't saved.
Probably most if not all of the messages in your message store are not needed and could be deleted, but it's more complicated than that because there are also entries in various database tables that should be removed as well.
Is there an outline as to how to clean up the var/messages hierarchy?
(I assume one has to be careful not to remove current held messages and maybe old ones that have not been processed; or maybe "old ones" can all be assumed orphaned, and thus, removed w/o concern?)
You could try something like this in mailman shell
>>> pendings = getUtility(IPendings)
>>> messages = getUtility(IMessageStore)
>>> mids = []
>>> for mlist in getUtility(IListManager):
... requests = IListRequests(mlist)
... for request in requests.held_requests:
... key, data = requests.get_request(request.id)
... if data.get('_mod_message_id'):
... mids.append(data.get('_mod_message_id'))
...
>>> for key, data in pendings:
... mid = data.get('_mod_message_id')
... if data['type'] != 'probe' and mid and mid not in mids:
... pendings.confirm(key, expunge=True)
... messages.delete_message(mid)
...
>>> commit()
This will find all the message ids from all held message requests, and
then find those pendings for message ids not DSNs and not found in
requests and delete the pending an the message store message.
--
Mark Sapiro <mark@msapiro.net> The highway is for gamblers,
San Francisco Bay Area, California better use your sense - B. Dylan