X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FMsgmap.pm;h=826c4b300a0d88370478fd608d4742fa37cd772e;hb=af0b0fb7a454470a32c452119d0392e0dedb3fe1;hp=f15875e37cd8a88c2b74956301892d4198be541f;hpb=2b52961cb0e77fc1645cc91318e3518f883313a3;p=public-inbox.git
diff --git a/lib/PublicInbox/Msgmap.pm b/lib/PublicInbox/Msgmap.pm
index f15875e3..826c4b30 100644
--- a/lib/PublicInbox/Msgmap.pm
+++ b/lib/PublicInbox/Msgmap.pm
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2020 all contributors
+# Copyright (C) 2015-2021 all contributors
# License: AGPL-3.0+
# bidirectional Message-ID <-> Article Number mapping for the NNTP
@@ -36,8 +36,7 @@ sub new_file {
create_tables($dbh);
$self->created_at(time) unless $self->created_at;
- my $max = $self->max // 0;
- $self->num_highwater($max);
+ $self->num_highwater(max($self));
$dbh->commit;
}
$self;
@@ -144,7 +143,7 @@ sub max {
my $sth = $_[0]->{dbh}->prepare_cached('SELECT MAX(num) FROM msgmap',
undef, 1);
$sth->execute;
- $sth->fetchrow_array;
+ $sth->fetchrow_array // 0;
}
sub minmax {
@@ -153,7 +152,7 @@ sub minmax {
my $sth = $_[0]->{dbh}->prepare_cached('SELECT MIN(num) FROM msgmap',
undef, 1);
$sth->execute;
- ($sth->fetchrow_array, max($_[0]));
+ ($sth->fetchrow_array // 0, max($_[0]));
}
sub mid_delete {