From: Eric Wong Date: Sat, 30 Nov 2024 08:26:32 +0000 (+0000) Subject: wqblocked: use per-instance unique timer X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=452753e9e3183ab9d602fe029fbb1d865abd04cd;p=thirdparty%2Fpublic-inbox.git wqblocked: use per-instance unique timer It was possible to end up with multiple timers being armed on a busy system from LeiNoteEvent due to the often rapid nature of renames. Since ->flush_send will flush all pending messages for the WQ, it's only necessary to arm a single timer for a given WQ socket. This saves some memory and unnecessary wakeups by using the handy unique timer mechanism in DS. --- diff --git a/lib/PublicInbox/WQBlocked.pm b/lib/PublicInbox/WQBlocked.pm index b2463898c..3e4d67f22 100644 --- a/lib/PublicInbox/WQBlocked.pm +++ b/lib/PublicInbox/WQBlocked.pm @@ -30,8 +30,8 @@ sub flush_send { PublicInbox::DS::epwait($wq_s1, EPOLLOUT|EPOLLONESHOT); } elsif ($!{ENOBUFS} || $!{ENOMEM}) { - PublicInbox::DS::add_timer(0.1, \&flush_send, - $self); + PublicInbox::DS::add_uniq_timer($self + 0, + 0.1, \&flush_send, $self); } else { Carp::croak("sendmsg: $!"); }