Show database statstics on the info page.

This commit is contained in:
2022-08-21 09:38:44 +09:30
parent 6f93f2ff50
commit db72e8fb7d
5 changed files with 37 additions and 7 deletions

View File

@@ -280,3 +280,12 @@ func (m *BookmarkManager) UpdateContent() {
time.Sleep(time.Second * 5)
}
}
func (m *BookmarkManager) Stats() (entity.DBStats, error) {
stats := entity.DBStats{}
err := m.db.store.Get("stats", &stats)
if err != nil && err != bolthold.ErrNotFound {
return stats, fmt.Errorf("could not load stats: %s", err)
}
return stats, nil
}