Documentation ¶
Overview ¶
Package mongo contains a helper function for ensuring mongo is up or down
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var IsMongoAlive atomicTypes.AtomicBool
IsMongoAlive is a global atomic bool that can be used to check if mongo is alive or not.
View Source
var MongoError error
MongoError is a global error that shows the last error that occurred with mongo.
Functions ¶
func InitializeDaemonChecker ¶
func InitializeDaemonChecker(callback func(bool))
InitializeDaemonChecker is a function that will check if mongo is up or down every 5 seconds and will invoke your callback function with the status of the connection after 10 seconds of tcp timeouts it will flag as false or every 5 seconds return true to you. You have to manage state if it has changed Something like
mongo.InitializeDaemonChecker(mongoDaemonCallback)
func mongoDaemonCallback(status bool) { type response struct { Status bool `json:"status"` } var json response json.Status = status PublishWebSocketJSON("Mongo", json) }
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.