feat: refactor watchdog
This commit is contained in:
+5
-4
@@ -5,6 +5,7 @@ import (
|
||||
"orbits-server/internal/server/api"
|
||||
"orbits-server/internal/server/bootstrap"
|
||||
"orbits-server/internal/server/database"
|
||||
"orbits-server/internal/server/watchdog"
|
||||
"orbits-server/internal/shared/utility"
|
||||
"os"
|
||||
)
|
||||
@@ -25,7 +26,7 @@ func main() {
|
||||
|
||||
// initiating the database connection for which we safe things
|
||||
slog.Info("kicking off database connection")
|
||||
db, err := database.KickoffDatabase(env.DataDirectory)
|
||||
db, err := database.Kickoff(env.DataDirectory)
|
||||
if err != nil {
|
||||
slog.Error("failed to initiate a database connection", "error", err)
|
||||
os.Exit(1)
|
||||
@@ -33,8 +34,8 @@ func main() {
|
||||
|
||||
// kick off the watchdog depending on the environment variables
|
||||
if env.Watchdog {
|
||||
slog.Info("kicking off database watchdog", "watchdog_interval", env.WatchdogInterval)
|
||||
database.KickoffDatabaseWatchdog(env, db)
|
||||
slog.Info("kicking off watchdog", "watchdog_interval", env.WatchdogInterval)
|
||||
watchdog.Kickoff(env, db)
|
||||
} else {
|
||||
slog.Info("skipping database watchdog", "watchdog_enabled", env.Watchdog)
|
||||
}
|
||||
@@ -42,5 +43,5 @@ func main() {
|
||||
// TO DO make gin log as json
|
||||
// get ready to kick off the http api with Vue frontend
|
||||
slog.Info("kicking off http api backend")
|
||||
api.KickoffApi(logger, env, db)
|
||||
api.Kickoff(logger, env, db)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user