Hot reload

This commit is contained in:
2024-01-31 13:46:12 +08:00
parent 7b544f370d
commit d2710d1718
4 changed files with 28 additions and 2 deletions

View File

@ -49,6 +49,7 @@ func ReadInConfig(root string) error {
return err
}
// Hot swap
R = instance
return nil

View File

@ -3,14 +3,19 @@ package navi
import "code.smartsheep.studio/goatworks/roadsign/pkg/warden"
func InitializeWarden(regions []*Region) {
pool := make([]*warden.AppInstance, 0)
for _, region := range regions {
for _, application := range region.Applications {
warden.InstancePool = append(warden.InstancePool, &warden.AppInstance{
pool = append(pool, &warden.AppInstance{
Manifest: application,
})
}
}
// Hot swap
warden.InstancePool = pool
for _, instance := range warden.InstancePool {
instance.Wake()
}