From a5e39d0e4e2d9b7ad937e8dd9af726d96eec6126 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 23 Jul 2022 04:41:50 +0000 Subject: ds: move requeue_once It's the same subroutine everywhere. --- lib/PublicInbox/DS.pm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lib/PublicInbox/DS.pm') diff --git a/lib/PublicInbox/DS.pm b/lib/PublicInbox/DS.pm index daef9d89..f0181b54 100644 --- a/lib/PublicInbox/DS.pm +++ b/lib/PublicInbox/DS.pm @@ -650,6 +650,20 @@ sub shutdn ($) { sub zflush {} # overridden by NNTPdeflate and IMAPdeflate +sub requeue_once { + my ($self) = @_; + # COMPRESS users all share the same DEFLATE context. + # Flush it here to ensure clients don't see + # each other's data + $self->zflush; + + # no recursion, schedule another call ASAP, + # but only after all pending writes are done. + # autovivify wbuf. wbuf may be populated by $cb, + # no need to rearm if so: (push returns new size of array) + requeue($self) if push(@{$self->{wbuf}}, $self->can('long_step')) == 1; +} + sub dwaitpid ($;$$) { my ($pid, $cb, $arg) = @_; if ($in_loop) { -- cgit v1.2.3-24-ge0c7