refactor: call renterd earlier but wait until its ready

This commit is contained in:
Derrick Hammer 2023-05-04 04:20:39 -04:00
parent b16beebabb
commit ca3d3588a4
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 7 additions and 5 deletions

12
main.go
View File

@ -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()