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.
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: $!");
}