From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, T_SCC_BODY_TEXT_LINE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id F01921F452 for ; Thu, 2 Nov 2023 09:35:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1698917741; bh=sywL4HORTo4tX6L4Lilng20NR4hNpHZiRVRHtKnQIx8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=H565l8s06rTAQiIFJtJWQKioPhemUvrsZ0539/AcETI7zq81gtCSCj1lrrEW46FI3 UiaIpNIBrjT943koFX46XX7TSuieIqYvmJw/W0bsFPf/7Euy27Zhs8YITaUGrp/Vi7 TCfWoMc49mXfA+u5S9bKn7Kj+9aXfTFSifl9pZDE= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 01/14] xap_helper.pm: use do_fork to Reset and reseed Date: Thu, 2 Nov 2023 09:35:26 +0000 Message-Id: <20231102093539.2067470-2-e@80x24.org> In-Reply-To: <20231102093539.2067470-1-e@80x24.org> References: <20231102093539.2067470-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: We may start using rand() in the worker someday if we need to seed a hash function for caching. It saves us some LoC in the meantime. --- lib/PublicInbox/XapHelper.pm | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/PublicInbox/XapHelper.pm b/lib/PublicInbox/XapHelper.pm index f7640f4c..41c66a12 100644 --- a/lib/PublicInbox/XapHelper.pm +++ b/lib/PublicInbox/XapHelper.pm @@ -216,14 +216,9 @@ sub reap_worker { # awaitpid CB sub start_worker ($) { my ($nr) = @_; - my $pid = fork; - if (!defined($pid)) { - warn("fork: $!"); - return undef; - }; + my $pid = eval { PublicInbox::DS::do_fork } // return(warn($@)); if ($pid == 0) { undef %WORKERS; - PublicInbox::DS::Reset(); $SIG{TTIN} = $SIG{TTOU} = 'IGNORE'; $SIG{CHLD} = 'DEFAULT'; # Xapian may use this recv_loop();