dumping ground for random patches and texts
 help / color / mirror / Atom feed
* [PATCH] v2 + lei/store: always wait for fast-import checkpoint
@ 2024-04-12 19:19 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2024-04-12 19:19 UTC (permalink / raw)
  To: spew

Since data going to git is the most important, always ensure
data is written to git before attempting to write anything to
SQLite or Xapian.
---
 lib/PublicInbox/LeiStore.pm   | 4 +---
 lib/PublicInbox/V2Writable.pm | 8 +-------
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/lib/PublicInbox/LeiStore.pm b/lib/PublicInbox/LeiStore.pm
index 2eb09eca..0df2352c 100644
--- a/lib/PublicInbox/LeiStore.pm
+++ b/lib/PublicInbox/LeiStore.pm
@@ -573,9 +573,7 @@ sub set_xvmd {
 
 sub checkpoint {
 	my ($self, $wait) = @_;
-	if (my $im = $self->{im}) {
-		$wait ? $im->barrier : $im->checkpoint;
-	}
+	$self->{im}->barrier if $self->{im};
 	delete $self->{lms};
 	$self->{priv_eidx}->checkpoint($wait);
 }
diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm
index fb259396..43f37f60 100644
--- a/lib/PublicInbox/V2Writable.pm
+++ b/lib/PublicInbox/V2Writable.pm
@@ -507,13 +507,7 @@ sub set_last_commits ($) { # this is NOT for ExtSearchIdx
 sub checkpoint ($;$) {
 	my ($self, $wait) = @_;
 
-	if (my $im = $self->{im}) {
-		if ($wait) {
-			$im->barrier;
-		} else {
-			$im->checkpoint;
-		}
-	}
+	$self->{im}->barrier if $self->{im};
 	my $shards = $self->{idx_shards};
 	if ($shards) {
 		my $dbh = $self->{mm}->{dbh} if $self->{mm};

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2024-04-12 19:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-12 19:19 [PATCH] v2 + lei/store: always wait for fast-import checkpoint Eric Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).