]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
inbox: introduce lock_file for inbox_idle
authorEric Wong <e@80x24.org>
Fri, 20 Jun 2025 20:39:40 +0000 (20:39 +0000)
committerEric Wong <e@80x24.org>
Tue, 24 Jun 2025 17:34:50 +0000 (17:34 +0000)
We may support idling on inbox-ish objects such as
PublicInbox::ExtSearch or similar (ActivityPub) objects in the
future, so taking version-specific knowledge out of InboxIdle
make sense for future changes.

lib/PublicInbox/Inbox.pm
lib/PublicInbox/InboxIdle.pm

index dd689221146ad53b73a3d3b770b37070e0f3d1f7..c519913736aa702af8b76e6b87dfa901b03f1389 100644 (file)
@@ -394,4 +394,9 @@ sub mailboxid { # rfc 8474, 8620, 8621
 
 sub thing_type { 'public inbox' }
 
+sub lock_file {
+       my ($self) = @_;
+       $self->{inboxdir}.($self->version >= 2 ? '/inbox.lock' : '/ssoma.lock')
+}
+
 1;
index 3c4d4a68249fa4fcc264793d1a5c1f15bca091df..468a6a926ad3d047f84169870851c4b1baa754bf 100644 (file)
@@ -24,7 +24,7 @@ sub in2_arm ($$) { # PublicInbox::Config::each_inbox callback
        my $dir = $ibx->{inboxdir};
        my $inot = $self->{inot};
        my $cur = $self->{pathmap}->{$dir} //= [];
-       my $lock = "$dir/".($ibx->version >= 2 ? 'inbox.lock' : 'ssoma.lock');
+       my $lock = $ibx->lock_file;
 
        # transfer old subscriptions to the current inbox, cancel the old watch
        my $old_ibx = $cur->[0];