milvus/cmd/tools/migration/command/backup.go
Jiquan Long d9081980e2
[skip e2e] Exit migration after session expired (#20282)
Signed-off-by: longjiquan <jiquan.long@zilliz.com>

Signed-off-by: longjiquan <jiquan.long@zilliz.com>
2022-11-03 11:47:36 +08:00

22 lines
592 B
Go

package command
import (
"context"
"github.com/milvus-io/milvus/cmd/tools/migration/configs"
"github.com/milvus-io/milvus/cmd/tools/migration/console"
"github.com/milvus-io/milvus/cmd/tools/migration/migration"
)
func Backup(c *configs.Config) {
ctx := context.Background()
runner := migration.NewRunner(ctx, c)
console.ExitIf(runner.CheckSessions())
console.ExitIf(runner.RegisterSession())
fn := func() { runner.Stop() }
defer fn()
// double check.
console.ExitIf(runner.CheckSessions(), console.AddCallbacks(fn))
console.ExitIf(runner.Backup(), console.AddCallbacks(fn))
}