From: Eric Wong <e@80x24.org>
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 [thread overview]
Message-ID: <20170626031545.11879-6-e@80x24.org> (raw)
In-Reply-To: <20170626031545.11879-1-e@80x24.org>
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
prev parent reply other threads:[~2017-06-26 3:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-26 3:15 [PATCH 0/5] watch: various bugfixes and fairness improvements Eric Wong
2017-06-26 3:15 ` [PATCH 1/5] watch: ensure HUP causes the scanner to be reloaded Eric Wong
2017-06-26 3:15 ` [PATCH 2/5] spamc: retry on EINTR Eric Wong
2017-06-26 3:15 ` [PATCH 3/5] watch: improve fairness during full rescans Eric Wong
2017-06-26 4:01 ` Eric Wong
2017-06-26 3:15 ` [PATCH 4/5] watch: use "self-inotify-tempfile trick" for quit Eric Wong
2017-06-26 3:15 ` Eric Wong [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170626031545.11879-6-e@80x24.org \
--to=e@80x24.org \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).