* [PATCH 5/5] watch: commit changes to fast-import sooner
2017-06-26 3:15 4% [PATCH 0/5] watch: various bugfixes and fairness improvements Eric Wong
@ 2017-06-26 3:15 7% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2017-06-26 3:15 UTC (permalink / raw)
To: meta
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
^ permalink raw reply related [relevance 7%]
* [PATCH 0/5] watch: various bugfixes and fairness improvements
@ 2017-06-26 3:15 4% Eric Wong
2017-06-26 3:15 7% ` [PATCH 5/5] watch: commit changes to fast-import sooner Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2017-06-26 3:15 UTC (permalink / raw)
To: meta
A fairly large reworking of "public-inbox-watch" to improve
fairness when processing large directory scans. There are
also some minor bugfixes for signal handling.
Eric Wong (5):
watch: ensure HUP causes the scanner to be reloaded
spamc: retry on EINTR
watch: improve fairness during full rescans
watch: use "self-inotify-tempfile trick" for quit
watch: commit changes to fast-import sooner
lib/PublicInbox/Spamcheck/Spamc.pm | 6 +-
lib/PublicInbox/WatchMaildir.pm | 110 +++++++++++++++++++++++++++++--------
script/public-inbox-watch | 9 ++-
t/watch_maildir.t | 12 ++--
4 files changed, 105 insertions(+), 32 deletions(-)
--
EW
^ permalink raw reply [relevance 4%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2017-06-26 3:15 4% [PATCH 0/5] watch: various bugfixes and fairness improvements Eric Wong
2017-06-26 3:15 7% ` [PATCH 5/5] watch: commit changes to fast-import sooner Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
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).