From: Eric Wong Date: Fri, 20 Jun 2025 20:39:40 +0000 (+0000) Subject: inbox: introduce lock_file for inbox_idle X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=058acb7676ef45c1be89615368f6bb62608878db;p=thirdparty%2Fpublic-inbox.git inbox: introduce lock_file for inbox_idle 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. --- diff --git a/lib/PublicInbox/Inbox.pm b/lib/PublicInbox/Inbox.pm index dd6892211..c51991373 100644 --- a/lib/PublicInbox/Inbox.pm +++ b/lib/PublicInbox/Inbox.pm @@ -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; diff --git a/lib/PublicInbox/InboxIdle.pm b/lib/PublicInbox/InboxIdle.pm index 3c4d4a682..468a6a926 100644 --- a/lib/PublicInbox/InboxIdle.pm +++ b/lib/PublicInbox/InboxIdle.pm @@ -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];