From 533dbd0204c563e0b374a1b4a7b13247ff5d758b Mon Sep 17 00:00:00 2001 From: Nick Goodall Date: Tue, 13 Jan 2026 17:45:28 +0000 Subject: [PATCH] fix timing --- main.go | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/main.go b/main.go index ee822e1..a6aea98 100644 --- a/main.go +++ b/main.go @@ -353,20 +353,23 @@ func shouldConfirmServerConfig(ctx *deploymentContext) (bool, error) { return !exists, nil } -func ensureServerConfigConfirmed(ctx *deploymentContext) (*deploymentContext, error) { +func ensureServerConfigConfirmed(ctx *deploymentContext) (*deploymentContext, bool, error) { needsConfirm, err := shouldConfirmServerConfig(ctx) if err != nil { - return nil, err + return nil, false, err } if !needsConfirm { - return ctx, nil + return ctx, false, nil } if err := confirmServerConfig(ctx.configPath); err != nil { - return nil, err + return nil, false, err } - - return buildDeploymentContext() + newCtx, err := buildDeploymentContext() + if err != nil { + return nil, false, err + } + return newCtx, true, nil } func confirmServerConfig(pbPath string) error { @@ -1009,7 +1012,7 @@ func runSetup() error { return err } - ctx, err = ensureServerConfigConfirmed(ctx) + ctx, _, err = ensureServerConfigConfirmed(ctx) if err != nil { return err } @@ -1080,7 +1083,7 @@ func runDeploy() error { defer func() { closeSSHControlMaster(ctx.serverIP) }() - var start time.Time + start := time.Now() binaryPath := filepath.Join(ctx.serviceDir, "pocketbase") exists, err := remoteBinaryExists(ctx.serverIP, binaryPath) @@ -1090,16 +1093,16 @@ func runDeploy() error { if err != nil || !exists { fmt.Println("PocketBase binary missing on remote; running setup") - ctx, err = ensureServerConfigConfirmed(ctx) + ctx, prompted, err := ensureServerConfigConfirmed(ctx) if err != nil { return err } - start = time.Now() + if prompted { + start = time.Now() + } if err := performSetup(ctx); err != nil { return err } - } else { - start = time.Now() } dirs := []string{"pb_public", "pb_migrations", "pb_hooks"}