about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-01-17 07:19:08 +0000
committerEric Wong <e@80x24.org>2023-01-18 23:26:02 +0000
commitd9fb47fe33c5796296549b96df3400299c551f49 (patch)
tree17b6255789642c6690fcea3684d637d5eec5b24c
parent84050272ef72aadbc2fc6abf106a27ff1bb3ddc7 (diff)
downloadpublic-inbox-d9fb47fe33c5796296549b96df3400299c551f49.tar.gz
An obvious error :x
-rw-r--r--lib/PublicInbox/Watch.pm11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/PublicInbox/Watch.pm b/lib/PublicInbox/Watch.pm
index 66b0c8b1..90d82d21 100644
--- a/lib/PublicInbox/Watch.pm
+++ b/lib/PublicInbox/Watch.pm
@@ -464,17 +464,18 @@ sub poll_fetch_fork { # DS::add_timer callback
         my ($self, $intvl, $uris) = @_;
         return if $self->{quit};
         watch_atfork_parent($self);
+        my @nntp;
+        my @imap = grep { # push() always returns > 0
+                $_->scheme =~ m!\Aimaps?!i ? 1 : (push(@nntp, $_) < 0)
+        } @$uris;
         my $seed = rand(0xffffffff);
         my $pid = fork // die "fork: $!";
         if ($pid == 0) {
                 srand($seed);
                 eval { Net::SSLeay::randomize() };
                 watch_atfork_child($self);
-                if ($uris->[0]->scheme =~ m!\Aimaps?!i) {
-                        watch_imap_fetch_all($self, $uris);
-                } else {
-                        watch_nntp_fetch_all($self, $uris);
-                }
+                watch_imap_fetch_all($self, \@imap) if @imap;
+                watch_nntp_fetch_all($self, \@nntp) if @nntp;
                 _exit(0);
         }
         $self->{pids}->{$pid} = undef;