notification::sweep::cleanup_notifications (private)

 notification::sweep::cleanup_notifications

Defined in packages/notifications/tcl/sweep-procs.tcl

Clean up the notifications that have been sent out (DRB: inefficiently...).

Partial Call Graph (max 5 caller/called nodes):
%3 db_list db_list (public) notification::delete notification::delete (public) notification::request::delete notification::request::delete (public) notification::sweep::cleanup_notifications notification::sweep::cleanup_notifications notification::sweep::cleanup_notifications->db_list notification::sweep::cleanup_notifications->notification::delete notification::sweep::cleanup_notifications->notification::request::delete

Testcases:
No testcase defined.
Source code:
        # before the killing starts, remove invalid requests
        foreach request_id [db_list select_invalid_request_ids {
           select request_id
             from notification_requests
            where
                  -- LARS
                  -- Also sweep the dynamic notification requests that have been sent out
                  (dynamic_p = 't' and
                   exists (select 1
                           from    notifications n,
                                   notification_user_map num
                           where   n.type_id = type_id
                           and     n.object_id = object_id
                           and     num.notification_id = n.notification_id
                           and     num.user_id = user_id))

               -- or not acs_permission.permission_p(object_id, user_id, 'read')
        }] {
            notification::request::delete -request_id $request_id
        }

        # Get the list of the ones to kill
        set notification_id_list [db_list select_notification_ids {}]

        # Kill them
        foreach notification_id $notification_id_list {
            notification::delete -notification_id $notification_id
        }
XQL Not present:
PostgreSQL, Oracle
Generic XQL file:
<fullquery name="notification::sweep::cleanup_notifications.select_notification_ids">
    <querytext>
           select notification_id
           from notifications
           where notification_id not in (
           select distinct notification_id
           from notifications inner join notification_requests using (type_id, object_id)
             inner join acs_objects on (notification_requests.request_id = acs_objects.object_id)
             left outer join notification_user_map using (notification_id, user_id)
           where sent_date is null and creation_date <= notif_date
           )  
        </querytext>
</fullquery>
packages/notifications/tcl/sweep-procs.xql

[ hide source ] | [ make this the default ]
Show another procedure: