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-ASN: X-Spam-Status: No, score=-4.1 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF 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 2128820185 for ; Mon, 28 Nov 2022 05:32:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1669613559; bh=8YxzjJfrVQrCm3H38l6TsFaZxfHOUKGL83dLYKSURTo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=BRp3ehBnyOel4SeBRZ6bDuZjQvctrltXfjdgBL28UgLeLN9rz7lGpVXbXNIPStEus PtVxWDWLxtaajL0X8ANbgWTYeVAR4dSftzJPWYv8DlKsecY+vb6/013CO4ugymI7Sh HtQcc7Ws6KATg42wSvjrsR52RXyJKkaOaqKNJjUU= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 31/95] lei_mirror: require PublicInbox::Lock at use Date: Mon, 28 Nov 2022 05:31:28 +0000 Message-Id: <20221128053232.291618-32-e@80x24.org> In-Reply-To: <20221128053232.291618-1-e@80x24.org> References: <20221128053232.291618-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: It's easier to understand why we lazy-load Lock for v2-only code paths when we require it near its first use. --- lib/PublicInbox/LeiMirror.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/PublicInbox/LeiMirror.pm b/lib/PublicInbox/LeiMirror.pm index 2b20873e..a7ddfcd2 100644 --- a/lib/PublicInbox/LeiMirror.pm +++ b/lib/PublicInbox/LeiMirror.pm @@ -384,6 +384,7 @@ sub v2_done { # called via OnDestroy my ($self) = @_; return if $self->{dry_run} || !$LIVE; my $dst = $self->{cur_dst} // $self->{dst}; + require PublicInbox::Lock; my $lk = bless { lock_path => "$dst/inbox.lock" }, 'PublicInbox::Lock'; my $lck = $lk->lock_for_scope($$); _write_inbox_config($self); @@ -461,7 +462,6 @@ failed to extract epoch number from $src (!$self->{dry_run} && !-d $dst) and File::Path::mkpath($dst); - require PublicInbox::Lock; my $fini = PublicInbox::OnDestroy->new($$, \&v2_done, $task); $lei->{opt}->{'inbox-config'} =~ /\A(?:always|v2)\z/s and