Scheduled tasks to clean up the database

- tasks run hourly
- uses celery beat to schedule the tasks

4 new tasks
- delete verify codes (after 1 day)
- delete invitations (after 1 day)
- delete successful notifications  (after 1 day)
- delete failed notifications (after 7 days)

Delete methods in the DAO classes
This commit is contained in:
Martyn Inglis
2016-03-09 17:46:01 +00:00
parent fbfa176895
commit c8a5366484
11 changed files with 298 additions and 37 deletions

View File

@@ -278,7 +278,9 @@ def sample_notification(notify_db,
service=None,
template=None,
job=None,
to_field=None):
to_field=None,
status='sent',
created_at=datetime.utcnow()):
if service is None:
service = sample_service(notify_db, notify_db_session)
if template is None:
@@ -300,7 +302,8 @@ def sample_notification(notify_db,
'service_id': service.id,
'service': service,
'template': template,
'created_at': datetime.utcnow()
'status': status,
'created_at': created_at
}
notification = Notification(**data)
dao_create_notification(notification, template.template_type)