]> Sergey Matveev's repositories - public-inbox.git/commitdiff
eofpipe: drop {arg} support for now
authorEric Wong <e@80x24.org>
Tue, 17 Jan 2023 07:19:07 +0000 (07:19 +0000)
committerEric Wong <e@80x24.org>
Wed, 18 Jan 2023 23:26:01 +0000 (23:26 +0000)
The only user of EOFpipe has no args, so avoid wasting a hash
slot on it.  If we need it again in the future, EOFpipe will
allow an array of args, instead.

lib/PublicInbox/Daemon.pm
lib/PublicInbox/EOFpipe.pm

index ee746f057d66b5a1df5daa196671026323d72bab..17e799ca686d00e6366078d2c538f3a5daffed59 100644 (file)
@@ -693,7 +693,7 @@ sub daemon_loop ($) {
        if ($worker_processes > 0) {
                $refresh->(); # preload by default
                my $fh = master_loop(); # returns if in child process
-               PublicInbox::EOFpipe->new($fh, \&worker_quit, undef);
+               PublicInbox::EOFpipe->new($fh, \&worker_quit);
        } else {
                reopen_logs();
                $set_user->() if $set_user;
index e537e2aa2f34612937aba50aac5d4b7b75911761..628e9366fe61dea68b56aa5c380368626071c8ed 100644 (file)
@@ -1,14 +1,14 @@
-# Copyright (C) 2020-2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 
 package PublicInbox::EOFpipe;
-use strict;
+use v5.12;
 use parent qw(PublicInbox::DS);
 use PublicInbox::Syscall qw(EPOLLIN EPOLLONESHOT);
 
 sub new {
-       my (undef, $rd, $cb, $arg) = @_;
-       my $self = bless {  cb => $cb, arg => $arg }, __PACKAGE__;
+       my (undef, $rd, $cb) = @_;
+       my $self = bless { cb => $cb }, __PACKAGE__;
        # 1031: F_SETPIPE_SZ, 4096: page size
        fcntl($rd, 1031, 4096) if $^O eq 'linux';
        $self->SUPER::new($rd, EPOLLIN|EPOLLONESHOT);
@@ -17,7 +17,7 @@ sub new {
 sub event_step {
        my ($self) = @_;
        if ($self->do_read(my $buf, 1) == 0) { # auto-closed
-               $self->{cb}->($self->{arg});
+               $self->{cb}->();
        }
 }