From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00, URIBL_BLOCKED shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id EAD7E1FA17; Mon, 31 Aug 2020 04:41:41 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Cc: Eric Wong Subject: [PATCH 07/11] watch: comments and tiny cleanups Date: Mon, 31 Aug 2020 04:41:36 +0000 Message-Id: <20200831044140.17027-8-e@80x24.org> In-Reply-To: <20200831044140.17027-1-e@80x24.org> References: <20200831044140.17027-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: From: Eric Wong 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 = '';