Index: openacs-4/packages/notifications/tcl/sweep-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/tcl/sweep-procs.tcl,v diff -u -r1.30 -r1.31 --- openacs-4/packages/notifications/tcl/sweep-procs.tcl 11 Sep 2024 06:15:52 -0000 1.30 +++ openacs-4/packages/notifications/tcl/sweep-procs.tcl 20 Dec 2024 12:14:52 -0000 1.31 @@ -10,6 +10,21 @@ namespace eval notification::sweep { + ad_proc -private cleanup_sse_subscriptions {} { + Cleanup unused SSE channels. + } { + foreach {subscription channels} [nsv_array get ::notification::sse channels-*] { + set to_user_id [string range $subscription [string length channels-] end] + foreach channel $channels { + try { + ns_connchan write $channel [string cat {: ping} \n\n] + } on error {errmsg} { + ::notification::sse::unsubscribe $channel $to_user_id + } + } + } + } + ad_proc -private cleanup_notifications {} { Clean up the notifications that have been sent out (DRB: inefficiently...). } {