All checks were successful
Build-Release-Image / Build-Image (linux/arm64) (push) Successful in 3m40s
Build-Release-Image / Build-Image (linux/amd64) (push) Successful in 4m7s
Build-Release-Image / Merge-Images (push) Successful in 22s
Build-Release-Image / Create-Release (push) Successful in 15s
Build-Release-Image / Notify (push) Successful in 17s
13 lines
376 B
Python
13 lines
376 B
Python
import arrow
|
|
|
|
from app.db import Session
|
|
from app.log import LOG
|
|
from app.models import Notification
|
|
|
|
|
|
def cleanup_old_notifications(oldest_allowed: arrow.Arrow):
|
|
LOG.i(f"Deleting notifications older than {oldest_allowed}")
|
|
count = Notification.filter(Notification.created_at < oldest_allowed).delete()
|
|
Session.commit()
|
|
LOG.i(f"Deleted {count} notifications")
|