From 8c4934f71a08e6a57510c96119f9136bca9249be Mon Sep 17 00:00:00 2001 From: Kunal Singh Date: Sun, 11 Feb 2024 12:20:18 +0530 Subject: [PATCH] fix: recreating is failing, does not recreate applicaiton --- internal/core/application/app.go | 33 ++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/internal/core/application/app.go b/internal/core/application/app.go index 9f97004..0fa47c0 100644 --- a/internal/core/application/app.go +++ b/internal/core/application/app.go @@ -329,22 +329,23 @@ func createNetwork(cli *client.Client, appName string) (string, error) { slog.Info("Creating network") networkName := appName + "_default" - nets, err := cli.NetworkList(context.Background(), types.NetworkListOptions{}) - if err != nil { - return "", err - } - // waiting for 5 seconds, if old network is in deletion process - // this problem only occur only recreating application - // in that case, old network was not deleted and we try to create a new network already - slog.Info("waiting for 5 seconds, if old network is in deletion process") - time.Sleep(5 * time.Second) - - for _, network := range nets { - if network.Name == networkName { - slog.Info("Network already exists") - return network.ID, nil - } - } + // nets, err := cli.NetworkList(context.Background(), types.NetworkListOptions{}) + // if err != nil { + // return "", err + // } + // // waiting for 5 seconds, if old network is in deletion process + // // this problem only occur only recreating application + // // in that case, old network was not deleted and we try to create a new network already + // // slog.Info("waiting for 5 seconds, if old network is in deletion process") + // // time.Sleep(5 * time.Second) + + // for _, network := range nets { + // slog.Info(network.Name) + // if network.Name == networkName { + // slog.Info("Network already exists") + // return network.ID, nil + // } + // } net, err := cli.NetworkCreate(context.Background(), networkName, types.NetworkCreate{ Scope: "swarm",