about summary refs log tree commit homepage
path: root/lib/PublicInbox
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-10-01 09:54:26 +0000
committerEric Wong <e@80x24.org>2023-10-01 22:41:47 +0000
commit3b8315e371c322ff59b31b36b14d9b7568e708fe (patch)
tree2ef88aa38d02e24b096bad52d67ed98a4c769301 /lib/PublicInbox
parentecc9bb5667aee11a05004516306a9fb5cae32971 (diff)
downloadpublic-inbox-3b8315e371c322ff59b31b36b14d9b7568e708fe.tar.gz
We can't use $DBD::SQLite::sqlite_version_number with older versions of
DBD::SQLite.  Thus we need to treat the $DBD::SQLite::sqlite_version
string (e.g. "3.8.3", not v-string) and convert it to a v-string with
eval for version comparisons to determine if we can fork multiple
children when using SQLite.

Fixes: fa04201baae9 ("lei: force --jobs=1,1 for SQLite < 3.8.3")
Diffstat (limited to 'lib/PublicInbox')
-rw-r--r--lib/PublicInbox/OverIdx.pm9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/PublicInbox/OverIdx.pm b/lib/PublicInbox/OverIdx.pm
index 6cc86d5d..5cea3706 100644
--- a/lib/PublicInbox/OverIdx.pm
+++ b/lib/PublicInbox/OverIdx.pm
@@ -671,13 +671,14 @@ sub vivify_xvmd {
 }
 
 sub fork_ok {
-        return 1 if $DBD::SQLite::sqlite_version >= 3008003;
+        state $fork_ok = eval("v$DBD::SQLite::sqlite_version") ge v3.8.3;
+        return 1 if $fork_ok;
         my ($opt) = @_;
         my @j = split(/,/, $opt->{jobs} // '');
         state $warned;
-        grep { $_ > 1 } @j and $warned //= warn('DBD::SQLite version is ',
-                 $DBD::SQLite::sqlite_version,
-                ", need >= 3008003 (3.8.3) for --jobs > 1\n");
+        grep { $_ > 1 } @j and $warned //= warn(<<EOM);
+DBD::SQLite version is v$DBD::SQLite::sqlite_version, need >= v3.8.3 for --jobs > 1
+EOM
         $opt->{jobs} = '1,1';
         undef;
 }