diff options
author | Eric Wong (Contractor, The Linux Foundation) <e@80x24.org> | 2018-03-19 08:14:49 +0000 |
---|---|---|
committer | Eric Wong (Contractor, The Linux Foundation) <e@80x24.org> | 2018-03-19 08:16:34 +0000 |
commit | fa53ccda7a0e4e975276ed421e7226393adb7ee8 (patch) | |
tree | 2c715fa1afb67ed32ab7ebe1029a1a9ac268ecca /lib/PublicInbox/V2Writable.pm | |
parent | d88d35ed7ad85d9b90c8e2e805f0d872df9e32fa (diff) | |
download | public-inbox-fa53ccda7a0e4e975276ed421e7226393adb7ee8.tar.gz |
Instead of using ssoma-based locking, enable locking via Import for now.
Diffstat (limited to 'lib/PublicInbox/V2Writable.pm')
-rw-r--r-- | lib/PublicInbox/V2Writable.pm | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm index a305842e..bdde76bb 100644 --- a/lib/PublicInbox/V2Writable.pm +++ b/lib/PublicInbox/V2Writable.pm @@ -26,10 +26,13 @@ sub nproc () { sub new { my ($class, $v2ibx, $creat) = @_; my $dir = $v2ibx->{mainrepo} or die "no mainrepo in inbox\n"; + my $lock_path = "$dir/inbox.lock"; unless (-d $dir) { if ($creat) { require File::Path; File::Path::mkpath($dir); + open my $fh, '>>', $lock_path or + die "failed to open $lock_path: $!\n"; } else { die "$dir does not exist\n"; } @@ -57,6 +60,7 @@ sub new { xap_ro => undef, partitions => $nparts, transact_bytes => 0, + lock_path => "$dir/inbox.lock", # limit each repo to 1GB or so rotate_bytes => int((1024 * 1024 * 1024) / $PACKING_FACTOR), }; @@ -395,7 +399,7 @@ sub import_init { my $im = PublicInbox::Import->new($git, undef, undef, $self->{-inbox}); $im->{bytes_added} = int($packed_bytes / $PACKING_FACTOR); $im->{want_object_info} = 1; - $im->{ssoma_lock} = 0; + $im->{lock_path} = $self->{lock_path}; $im->{path_type} = 'v2'; $self->{im} = $im; } |