add code for VmBeingModified endpoint
This commit is contained in:
22
main.go
22
main.go
@@ -78,7 +78,7 @@ func main() {
|
||||
bindPort = "9443"
|
||||
}
|
||||
bindAddress := fmt.Sprint(bindIP, ":", bindPort)
|
||||
slog.Info("Will listen on address", "ip", bindIP, "port", bindPort)
|
||||
//logger.Info("Will listen on address", "ip", bindIP, "port", bindPort)
|
||||
|
||||
// Determine bind disable TLS
|
||||
bindDisableTlsEnv := os.Getenv("BIND_DISABLE_TLS")
|
||||
@@ -103,7 +103,7 @@ func main() {
|
||||
|
||||
// Generate certificate if required
|
||||
if !(utils.FileExists(tlsCertFilename) && utils.FileExists(tlsKeyFilename)) {
|
||||
slog.Warn("Specified TLS certificate or private key do not exist", "certificate", tlsCertFilename, "tls-key", tlsKeyFilename)
|
||||
logger.Warn("Specified TLS certificate or private key do not exist", "certificate", tlsCertFilename, "tls-key", tlsKeyFilename)
|
||||
utils.GenerateCerts(tlsCertFilename, tlsKeyFilename)
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ func main() {
|
||||
}
|
||||
logger.Debug("Setting VM polling cronjob frequency to", "frequency", cronFrequency)
|
||||
|
||||
// start background processing
|
||||
// start background processing for events stored in events table
|
||||
startsAt := time.Now().Add(time.Second * 10)
|
||||
job, err := s.NewJob(
|
||||
gocron.DurationJob(cronFrequency),
|
||||
@@ -132,9 +132,23 @@ func main() {
|
||||
logger.Error("failed to start cron jobs", "error", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
logger.Debug("Created event processing cron job", "job", job.ID())
|
||||
|
||||
slog.Debug("Created cron job", "job", job)
|
||||
startsAt2 := time.Now().Add(time.Second * 10)
|
||||
job2, err := s.NewJob(
|
||||
gocron.DurationJob(cronFrequency),
|
||||
gocron.NewTask(func() {
|
||||
c.RunVcenterPoll(ctx, logger)
|
||||
}), gocron.WithSingletonMode(gocron.LimitModeReschedule),
|
||||
gocron.WithStartAt(gocron.WithStartDateTime(startsAt2)),
|
||||
)
|
||||
if err != nil {
|
||||
logger.Error("failed to start cron jobs", "error", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
logger.Debug("Created vcenter polling cron job", "job", job2.ID())
|
||||
|
||||
// start cron scheduler
|
||||
s.Start()
|
||||
|
||||
// Start server
|
||||
|
Reference in New Issue
Block a user