user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 07/11] watch: comments and tiny cleanups
  2020-08-31  4:41  6% [PATCH 00/11] watch: fix contention w/ Maildir & NNTP Eric Wong
@ 2020-08-31  4:41  7% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2020-08-31  4:41 UTC (permalink / raw)
  To: meta; +Cc: Eric Wong

From: Eric Wong <e@yhbt.net>

Get rid of an unused variable, prefix a warning and try to
better document control flow around various callbacks.
---
 lib/PublicInbox/Watch.pm | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lib/PublicInbox/Watch.pm b/lib/PublicInbox/Watch.pm
index 2698c44a..db8d0396 100644
--- a/lib/PublicInbox/Watch.pm
+++ b/lib/PublicInbox/Watch.pm
@@ -268,7 +268,7 @@ sub watch_fs_init ($) {
 		delete $self->{done_timer};
 		_done_for_now($self);
 	};
-	my $cb = sub {
+	my $cb = sub { # called by PublicInbox::DirIdle::event_step
 		_try_path($self, $_[0]->fullname);
 		$self->{done_timer} //= PublicInbox::DS::requeue($done);
 	};
@@ -411,7 +411,7 @@ sub imap_import_msg ($$$$$) {
 	if (ref($inboxes)) {
 		for my $ibx (@$inboxes) {
 			my $eml = PublicInbox::Eml->new($$raw);
-			my $x = import_eml($self, $ibx, $eml);
+			import_eml($self, $ibx, $eml);
 		}
 	} elsif ($inboxes eq 'watchspam') {
 		# we don't remove unseen messages
@@ -566,7 +566,7 @@ sub watch_imap_idle_1 ($$$) {
 			$err = imap_fetch_all($self, $mic, $url);
 			$err //= imap_idle_once($self, $mic, $intvl, $url);
 		} else {
-			$err = "not connected: $!";
+			$err = "E: not connected: $!";
 		}
 		if ($err && !$self->{quit}) {
 			warn $err, "\n";
@@ -984,7 +984,7 @@ sub watch_nntp_init ($$) {
 	}
 }
 
-sub watch {
+sub watch { # main entry point
 	my ($self, $sig, $oldset) = @_;
 	$self->{oldset} = $oldset;
 	$self->{sig} = $sig;
@@ -998,7 +998,7 @@ sub watch {
 	}
 	watch_fs_init($self) if $self->{mdre};
 	PublicInbox::DS->SetPostLoopCallback(sub { !$self->quit_done });
-	PublicInbox::DS->EventLoop;
+	PublicInbox::DS->EventLoop; # calls ->event_step
 	_done_for_now($self);
 }
 
@@ -1083,7 +1083,7 @@ sub content_exists ($$) {
 
 sub _spamcheck_cb {
 	my ($sc) = @_;
-	sub {
+	sub { # this gets called by (V2Writable||Import)->add
 		my ($mime, $ibx) = @_;
 		return if content_exists($ibx, $mime);
 		my $tmp = '';

^ permalink raw reply related	[relevance 7%]

* [PATCH 00/11] watch: fix contention w/ Maildir & NNTP
@ 2020-08-31  4:41  6% Eric Wong
  2020-08-31  4:41  7% ` [PATCH 07/11] watch: comments and tiny cleanups Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2020-08-31  4:41 UTC (permalink / raw)
  To: meta

Here's a bunch of fixes to improve watch performance when
both Maildirs and NNTP are being watched (possibly on the same
inbox, or if `watchspam' is configured for spam removals).

Wakeups are reduced, and inbox.lock contention is minimized by
using read-only ->over to check for `watchspam' removals.

These affect IMAP, too; but I've been mainly using NNTP.

Eric Wong (11):
  watch: limit batch size of NNTP and IMAP workers, too
  watchmaildir: use v5.10.1, drop warnings
  rename WatchMaildir => Watch
  watch: log signal activities to STDERR
  watch: avoid unnecessary spawning on spam removals
  watch: block signals before fork on non-signalfd/kevent systems
  watch: comments and tiny cleanups
  ds: avoid excessive queueing when reaping PIDs
  watch: use EOFpipe to reduce dwaitpid wakeups
  ds: avoid unnecessary timer for waitpid
  replace ParentPipe with EOFpipe

 MANIFEST                                      |   4 +-
 lib/PublicInbox/DS.pm                         |  38 +++---
 lib/PublicInbox/Daemon.pm                     |   6 +-
 lib/PublicInbox/EOFpipe.pm                    |  24 ++++
 lib/PublicInbox/Import.pm                     |   3 +
 lib/PublicInbox/ParentPipe.pm                 |  23 ----
 lib/PublicInbox/V2Writable.pm                 |   3 +
 lib/PublicInbox/{WatchMaildir.pm => Watch.pm} | 111 +++++++++++++-----
 script/public-inbox-watch                     |  34 ++++--
 t/imapd.t                                     |   2 +-
 t/nntpd.t                                     |   2 +-
 t/watch_filter_rubylang.t                     |   4 +-
 t/watch_imap.t                                |   4 +-
 t/watch_maildir.t                             |  18 +--
 t/watch_maildir_v2.t                          |  22 ++--
 t/watch_multiple_headers.t                    |   4 +-
 t/watch_nntp.t                                |   4 +-
 17 files changed, 190 insertions(+), 116 deletions(-)
 create mode 100644 lib/PublicInbox/EOFpipe.pm
 delete mode 100644 lib/PublicInbox/ParentPipe.pm
 rename lib/PublicInbox/{WatchMaildir.pm => Watch.pm} (92%)

^ permalink raw reply	[relevance 6%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2020-08-31  4:41  6% [PATCH 00/11] watch: fix contention w/ Maildir & NNTP Eric Wong
2020-08-31  4:41  7% ` [PATCH 07/11] watch: comments and tiny cleanups 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).