From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 1CB2A20838 for ; Mon, 26 Jun 2017 03:15:46 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 5/5] watch: commit changes to fast-import sooner Date: Mon, 26 Jun 2017 03:15:45 +0000 Message-Id: <20170626031545.11879-6-e@80x24.org> In-Reply-To: <20170626031545.11879-1-e@80x24.org> References: <20170626031545.11879-1-e@80x24.org> List-Id: We should make changes visible sooner, even during lengthy scans. --- lib/PublicInbox/WatchMaildir.pm | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/PublicInbox/WatchMaildir.pm b/lib/PublicInbox/WatchMaildir.pm index b867edc..b0ad2a7 100644 --- a/lib/PublicInbox/WatchMaildir.pm +++ b/lib/PublicInbox/WatchMaildir.pm @@ -91,13 +91,18 @@ sub new { sub _done_for_now { my ($self) = @_; + my $importers = $self->{importers}; + foreach my $im (values %$importers) { + $im->done if $im->{nchg}; + } + my $opendirs = $self->{opendirs}; # spamdir scanning means every importer remains open my $spamdir = $self->{spamdir}; return if defined($spamdir) && $opendirs->{$spamdir}; - foreach my $im (values %{$self->{importers}}) { + foreach my $im (values %$importers) { # not done if we're scanning next if $opendirs->{$im->{git}->{git_dir}}; $im->done; @@ -262,11 +267,9 @@ sub scan { $opendirs->{$dir} = $dh if $n < 0; } } - if (keys %$opendirs) { # do we have more work to do? - trigger_scan($self, 'cont'); - } else { - _done_for_now($self); - } + _done_for_now($self); + # do we have more work to do? + trigger_scan($self, 'cont') if keys %$opendirs; } sub _path_to_mime { -- EW