🐛 Fix preheat didn't run yet
All checks were successful
release-nightly / build-docker (push) Successful in 1m7s
All checks were successful
release-nightly / build-docker (push) Successful in 1m7s
This commit is contained in:
parent
426af568dc
commit
eae2b12764
@ -40,6 +40,7 @@ func doSyncSite(c *fiber.Ctx) error {
|
||||
|
||||
// Reload
|
||||
sign.ReadInConfig(viper.GetString("paths.configs"))
|
||||
sign.App.PreheatProcesses(func(total int, success int) {})
|
||||
|
||||
return c.SendStatus(fiber.StatusOK)
|
||||
}
|
||||
|
@ -50,6 +50,12 @@ func main() {
|
||||
log.Info().Int("count", len(sign.App.Sites)).Msg("All configuration has been loaded.")
|
||||
}
|
||||
|
||||
// Preheat processes
|
||||
log.Info().Msg("Preheating processes...")
|
||||
sign.App.PreheatProcesses(func(total int, success int) {
|
||||
log.Info().Int("requested", total).Int("succeed", success).Msgf("Preheat processes completed!")
|
||||
})
|
||||
|
||||
// Init hypertext server
|
||||
hypertext.RunServer(
|
||||
hypertext.InitServer(),
|
||||
|
@ -80,7 +80,7 @@ func (v *ProcessConfig) StopProcess() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (v *RoadApp) PreheatProcesses() {
|
||||
func (v *RoadApp) PreheatProcesses(callback func(total int, success int)) {
|
||||
var processes []*ProcessConfig
|
||||
for _, site := range v.Sites {
|
||||
for _, process := range site.Processes {
|
||||
@ -90,7 +90,12 @@ func (v *RoadApp) PreheatProcesses() {
|
||||
}
|
||||
}
|
||||
|
||||
success := 0
|
||||
for _, process := range processes {
|
||||
process.BootProcess()
|
||||
if process.BootProcess() == nil {
|
||||
success++
|
||||
}
|
||||
}
|
||||
|
||||
callback(len(processes), success)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user