Documentation
¶
Overview ¶
Package dbwatch - whether the site's database answers: a loop pinging it, so the requests and the background work learn it is gone at once instead of each waiting for a connection that doesn't come.
Index ¶
Constants ¶
View Source
const ( // Interval - how often the database is pinged. Interval = 5 * time.Second )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Watch ¶
type Watch struct {
// contains filtered or unexported fields
}
Watch - whether the database answers (Down), from a ping every Interval (Start). A nil Watch - the database is never down.
func New ¶
New - a watch pinging the database with ping, telling logger when it goes and comes back.
func (*Watch) Check ¶
Check pings the database once: failuresDown failures in a row make it down, an answer up again. Both changes are logged - here, the loop has nobody to return them to.
func (*Watch) Done ¶
func (w *Watch) Done() <-chan struct{}
Done - closed once the loop Start began has returned.
Click to show internal directories.
Click to hide internal directories.