From ca3d3588a43a1d8b1bddc5e25c11ddb41878f540 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Thu, 4 May 2023 04:20:39 -0400 Subject: [PATCH] refactor: call renterd earlier but wait until its ready --- main.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index 5e5f178..72fbf0e 100644 --- a/main.go +++ b/main.go @@ -29,8 +29,8 @@ var embedFrontend embed.FS // @license.name MIT // @license.url https://opensource.org/license/mit/ -// @externalDocs.description OpenAPI -// @externalDocs.url https://swagger.io/resources/open-api/ +// @externalDocs.description OpenAPI +// @externalDocs.url https://swagger.io/resources/open-api/ func main() { // Initialize the configuration settings config.Init() @@ -38,6 +38,11 @@ func main() { // Initialize the database connection db.Init() + // Start the renterd process in a goroutine + go renterd.Main() + + renterd.Ready() + // Create a new Iris app instance app := iris.New() @@ -76,9 +81,6 @@ func main() { // And the wildcard one for index.html, *.js, *.css and e.t.c. app.Get("/swagger/{any:path}", swaggerUI) - // Start the renterd process in a goroutine - //go renterd.Main() - // Start the Iris app and listen for incoming requests on port 80 log.Fatal(app.Listen(":8080", func(app *iris.Application) { routes := app.GetRoutes()