Thomas Weißschuh <[email protected]> wrote:
> It didn't help, neither did larger sleeps.
Thanks for testing.
> I'll see if I can debug it in the coming days.
OK, maybe the patch below can get you started...
I've also been wondering if something like GIT_TRACE is
necessary, but it's also more work to support + document.
And Perl code is easily modified compared to AOT languages.
diff --git a/lib/PublicInbox/LeiXSearch.pm b/lib/PublicInbox/LeiXSearch.pm
index 2a037f2bd79b..a0982138966e 100644
--- a/lib/PublicInbox/LeiXSearch.pm
+++ b/lib/PublicInbox/LeiXSearch.pm
@@ -281,13 +281,19 @@ sub each_remote_eml { # callback for MboxReader->mboxrd
my ($eml, $self, $lei, $each_smsg) = @_;
my $xoids = $lei->{ale}->xoids_for($eml, 1);
my $smsg = bless {}, 'PublicInbox::Smsg';
+ use Data::Dumper;
if ($self->{import_sto} && !$xoids) {
my ($res, $kw) = $self->{import_sto}->wq_do('add_eml', $eml);
if (ref($res) eq ref($smsg)) { # totally new message
$smsg = $res;
+ $lei->qerr("# imported <$smsg->{mid}>") if $ENV{DBG};
$self->{-imported} = 1;
+ } elsif ($ENV{DBG}) {
+ $lei->qerr("# res, kw = ".Dumper([$res, $kw]));
}
$smsg->{kw} = $kw; # short-circuit xsmsg_vmd
+ } elsif ($ENV{DBG}) {
+ $lei->qerr("# no import $self->{import_sto}".Dumper($xoids));
}
$smsg->{blob} //= $xoids ? (keys(%$xoids))[0]
: $lei->git_oid($eml)->hexdigest;
@@ -378,6 +384,9 @@ sub query_remote_mboxrd {
$lei, $each_smsg);
if ($self->{import_sto} && delete($self->{-imported})) {
my $wait = $self->{import_sto}->wq_do('done');
+ $lei->qerr("# flushed imported messages") if $ENV{DBG};
+ } elsif ($ENV{DBG}) {
+ $lei->qerr("# nothing flushed $self->{import_sto}");
}
$reap_curl->join;
if ($? == 0) {
diff --git a/t/lei-q-remote-import.t b/t/lei-q-remote-import.t
index 92d8c9b6058c..e10af2eb7849 100644
--- a/t/lei-q-remote-import.t
+++ b/t/lei-q-remote-import.t
@@ -32,7 +32,11 @@ test_lei({ tmpdir => $tmpdir }, sub {
lei_ok(@cmd);
ok(-f $o && !-s _, 'output exists but is empty');
unlink $o or BAIL_OUT $!;
- lei_ok(@cmd, '-I', $url);
+ lei_ok([@cmd, '-I', $url], { DBG => 1 });
+
+# should say 'imported <[email protected]>' + 'flushed imported messages'
+ diag $lei_err;
+return; # drop this if the above diag looks right
is_deeply($slurp_emls->($o), $exp1, 'got results after remote search');
unlink $o or BAIL_OUT $!;
lei_ok(@cmd);
--
unsubscribe: one-click, see List-Unsubscribe header
archive: https://public-inbox.org/meta/