worker: Redeclare storage early on reconnect

This commit is contained in:
Łukasz Magiera 2020-09-28 21:11:25 +02:00
parent 810c767200
commit bf554d0e43

View File

@ -428,12 +428,9 @@ var runCmd = &cli.Command{
go func() {
var reconnect bool
for {
log.Info("Making sure no local tasks are running")
// TODO: we could get rid of this, but that requires tracking resources for restarted tasks correctly
workerApi.LocalWorker.WaitQuiet()
if reconnect {
log.Info("Redeclaring local storage")
if err := localStore.Redeclare(ctx); err != nil {
log.Errorf("Redeclaring local storage failed: %+v", err)
cancel()
@ -441,6 +438,12 @@ var runCmd = &cli.Command{
}
}
log.Info("Making sure no local tasks are running")
// TODO: we could get rid of this, but that requires tracking resources for restarted tasks correctly
workerApi.LocalWorker.WaitQuiet()
if err := nodeApi.WorkerConnect(ctx, "ws://"+address+"/rpc/v0"); err != nil {
log.Errorf("Registering worker failed: %+v", err)
cancel()