]> Sergey Matveev's repositories - public-inbox.git/commitdiff
lei_mail_sync: debug code for uncommitted txn
authorEric Wong <e@80x24.org>
Fri, 28 May 2021 00:07:54 +0000 (00:07 +0000)
committerEric Wong <e@80x24.org>
Fri, 28 May 2021 03:49:27 +0000 (03:49 +0000)
I'm not 100% sure why, but "lei up" seems to cause uncommitted
transaction errors.  LeiToMail calls sto->set_sync_info, but
LeiXSearch should call sto->done and lms_commit, so I'm not
sure where the uncommited transaction is coming from...

lib/PublicInbox/LeiMailSync.pm
lib/PublicInbox/LeiXSearch.pm

index d9c305800bad91bb4eab51f45e6609dec3afcc31..6120d59fd55b664bb0d519c333afbe775da72580 100644 (file)
@@ -356,4 +356,14 @@ sub forget_folder {
        $dbh->do('DELETE FROM folders WHERE fid = ?', undef, $fid);
 }
 
+# FIXME: something with "lei <up|q>" is causing uncommitted transaction
+# warnings, not sure what...
+sub DESTROY {
+       my ($self) = @_;
+       my $dbh = $self->{dbh} or return;
+       return if $dbh->{ReadOnly};
+       use Carp;
+       warn "BUG $$ $0 $self {dbh} UNCOMMITTED ", Carp::longmess();
+}
+
 1;
index 3482082dfe967e7577813caa0eea6412e8c5246b..e2a8e8e3b6881a360c6db2458c5c6c9466c6ea6b 100644 (file)
@@ -357,6 +357,9 @@ sub query_done { # EOF callback for main daemon
        if (my $lxs = delete $lei->{lxs}) {
                $lxs->wq_wait_old(\&xsearch_done_wait, $lei);
        }
+       if ($lei->{opt}->{'mail-sync'} && !$lei->{sto}) {
+               warn "BUG: {sto} missing with --mail-sync";
+       }
        my $wait = $lei->{sto} ? $lei->{sto}->ipc_do('done') : undef;
        $lei->{ovv}->ovv_end($lei);
        my $start_mua;