Download this file
| 1 | package host |
| 2 | |
| 3 | import ( |
| 4 | "context" |
| 5 | "log" |
| 6 | |
| 7 | "github.com/carlosframework/platform/internal/activator" |
| 8 | "github.com/carlosframework/platform/internal/registry" |
| 9 | "github.com/carlosframework/platform/internal/release" |
| 10 | ) |
| 11 | |
| 12 | func (n namedUnitRecovery) passOption(reg *registry.Registry, checks rootRestartChecks, getenv func(string) string) release.PassOption { |
| 13 | remainingNamed := false |
| 14 | return release.WithRecovery(func(ctx context.Context, rt registry.Route) (bool, error) { |
| 15 | done, err := n.recover(ctx, rt.Host, checks, getenv, reg) |
| 16 | if err != nil { |
| 17 | log.Printf("adopt: %v", err) |
| 18 | return true, nil |
| 19 | } |
| 20 | if !done && (release.Adoptable(rt) || release.SidecarAdoptable(rt)) && rt.Unit != "" && rt.Unit != activator.UnitName(rt.Host) { |
| 21 | remainingNamed = true |
| 22 | } |
| 23 | return done, nil |
| 24 | }, func() (bool, error) { |
| 25 | named := remainingNamed |
| 26 | remainingNamed = false |
| 27 | if !named { |
| 28 | return true, nil |
| 29 | } |
| 30 | return checks.allowLegacy() |
| 31 | }) |
| 32 | } |
| 33 | |