MCPcopy Create free account
hub / github.com/cloudwan/gohan / emitPostMigrateEvent

Function emitPostMigrateEvent

cli/migrate.go:102–134  ·  view source on GitHub ↗
(forcedSchemas string, syncETCDEvent bool, postMigrationEventTimeout time.Duration)

Source from the content-addressed store, hash-verified

100}
101
102func emitPostMigrateEvent(forcedSchemas string, syncETCDEvent bool, postMigrationEventTimeout time.Duration) {
103 config := util.GetConfig()
104
105 log.Info("Emit post-migrate event")
106
107 modifiedSchemas := selectModifiedSchemas(forcedSchemas)
108
109 if len(modifiedSchemas) == 0 {
110 log.Info("No modified schemas, skipping post-migration event")
111 return
112 }
113
114 log.Debug("Modified schemas: %s", strings.Join(modifiedSchemas, ", "))
115
116 schemaFiles := config.GetStringList("schemas", nil)
117
118 if schemaFiles == nil {
119 log.Fatal("No schema specified in configuration")
120 }
121
122 manager := schema.GetManager()
123 if err := manager.LoadSchemasFromFiles(schemaFiles...); err != nil {
124 log.Fatal(err)
125 }
126
127 if err := publishEvent(postMigrationEnvName, modifiedSchemas, eventPostMigration, syncETCDEvent, postMigrationEventTimeout); err != nil {
128 log.Fatal("Publish post-migrate event failed: %s", err)
129 }
130
131 schema.ClearManager()
132
133 log.Info("Published post-migrate event: %s", strings.Join(modifiedSchemas, ", "))
134}
135
136func actionMigrate(subcmd string) func(context *cli.Context) {
137 return withinLockedMigration(func(context *cli.Context) {

Callers 1

Calls 8

selectModifiedSchemasFunction · 0.85
publishEventFunction · 0.85
JoinMethod · 0.80
GetStringListMethod · 0.80
FatalMethod · 0.80
LoadSchemasFromFilesMethod · 0.80
InfoMethod · 0.65
DebugMethod · 0.65

Tested by

no test coverage detected