Karta. Messaging. Retention
(Karta v1.0.0)
Removes messages and media that have outlived their organisation's
retention (Karta.Messaging.retention/1: the organisation's days, or
KARTA_MESSAGING_RETENTION_DAYS, default 730, or "keep" for never), and
every authentication message (a sign-in code) after 7 days whatever
the organisation chose. An Oban cron job every night, on one node; any
number of nodes may run it at once.
In batches, the blob before the row: a media file's bytes are
deleted from the store (Karta.Messaging.Purge) and only then its row;
a message whose file could not be deleted stays for the next night, so a
failure leaves a row to try again and never a file nobody can find.
Conversations left with no message go with them, and so do the stored
send requests (which hold the text of what was asked for) and media
files no message ever held, by the same rule.
Summary
Functions
One run at now (option). Options batch, max_batches, blob_store.
Returns how many messages, orphan media files, requests and
conversations were removed.