fix timing
This commit is contained in:
25
main.go
25
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
|
||||
}
|
||||
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"}
|
||||
|
||||
Reference in New Issue
Block a user