Use sockets for server creation progress

This commit is contained in:
Fran Jurmanović
2025-09-18 01:06:58 +02:00
parent 760412d7db
commit 901dbe697e
17 changed files with 1314 additions and 188 deletions

View File

@@ -139,10 +139,16 @@ func (ac *ServerController) CreateServer(c *fiber.Ctx) error {
if err := c.BodyParser(server); err != nil {
return ac.errorHandler.HandleParsingError(c, err)
}
ac.service.GenerateServerPath(server)
if err := ac.service.CreateServer(c, server); err != nil {
server.GenerateUUID()
// Use async server creation to avoid blocking other requests
if err := ac.service.CreateServerAsync(c, server); err != nil {
return ac.errorHandler.HandleServiceError(c, err)
}
// Return immediately with server details
// The actual creation will happen in the background with WebSocket updates
return c.JSON(server)
}