GODT-1843: Wait for the currently running application on restart even while updating

This commit is contained in:
Romain LE JEUNE
2022-09-05 19:47:06 +02:00
parent 4e47e7ac2a
commit 5ae50047e0
16 changed files with 951 additions and 634 deletions

View File

@ -94,11 +94,12 @@ type Base struct {
TLS *tls.TLS
Autostart *autostart.App
Name string // the app's name
usage string // the app's usage description
command string // the command used to launch the app (either the exe path or the launcher path)
restart bool // whether the app is currently set to restart
launcher string // launcher to be used if not set in args
Name string // the app's name
usage string // the app's usage description
command string // the command used to launch the app (either the exe path or the launcher path)
restart bool // whether the app is currently set to restart
launcher string // launcher to be used if not set in args
mainExecutable string // mainExecutable the main executable process.
teardown []func() error // actions to perform when app is exiting
}
@ -269,6 +270,9 @@ func New( //nolint:funlen
// By default, the command is the app's executable.
// This can be changed at runtime by using the "--launcher" flag.
command: exe,
// By default, the command is the app's executable.
// This can be changed at runtime by summoning the SetMainExecutable gRPC call.
mainExecutable: exe,
}, nil
}
@ -329,6 +333,11 @@ func (b *Base) ForceLauncher(launcher string) {
b.setupLauncher(launcher)
}
func (b *Base) SetMainExecutable(exe string) {
logrus.Info("Main Executable set to ", exe)
b.mainExecutable = exe
}
// AddTeardownAction adds an action to perform during app teardown.
func (b *Base) AddTeardownAction(fn func() error) {
b.teardown = append(b.teardown, fn)