about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-04-18 00:58:06 +0000
committerEric Wong <e@80x24.org>2019-04-18 06:07:24 +0000
commitb241b1ac6f8b0b47c69dad47716ac9b184e4c098 (patch)
tree3f007789a9551117d571021b5f175975d3a25705
parent7973bc101755b13a1381579c5ee60a716da6ffe1 (diff)
downloadpublic-inbox-b241b1ac6f8b0b47c69dad47716ac9b184e4c098.tar.gz
For inboxes with SQLite enabled (all v2, and probably most v1);
we can use the overview DB to get the timestamp of the latest
message.  It's faster than scanning git branches for commit times,
but not always the same.
-rw-r--r--lib/PublicInbox/Inbox.pm12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/PublicInbox/Inbox.pm b/lib/PublicInbox/Inbox.pm
index cde46258..0d28dd04 100644
--- a/lib/PublicInbox/Inbox.pm
+++ b/lib/PublicInbox/Inbox.pm
@@ -333,4 +333,16 @@ sub recent {
         search($self)->{over_ro}->recent($opts, $after, $before);
 }
 
+sub modified {
+        my ($self) = @_;
+        if (my $srch = search($self)) {
+                my $msgs = $srch->{over_ro}->recent({limit => 1});
+                if (my $smsg = $msgs->[0]) {
+                        return $smsg->{ts};
+                }
+                return time;
+        }
+        git($self)->modified; # v1
+}
+
 1;