1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-09-15 18:57:04 +00:00

Add option to disable watchdog and set default timeout to DB healthcheck

This commit is contained in:
Frédéric Guillot 2021-05-23 18:24:57 -07:00 committed by fguillot
parent 36d3b1e9fb
commit e0557d8961
4 changed files with 18 additions and 2 deletions

View file

@ -5,7 +5,9 @@
package storage // import "miniflux.app/storage"
import (
"context"
"database/sql"
"time"
)
// Storage handles all operations related to the database.
@ -31,7 +33,10 @@ func (s *Storage) DatabaseVersion() string {
// Ping checks if the database connection works.
func (s *Storage) Ping() error {
return s.db.Ping()
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
return s.db.PingContext(ctx)
}
// DBStats returns database statistics.