Skip to content

Commit

Permalink
add ping interval to config
Browse files Browse the repository at this point in the history
  • Loading branch information
saffronjam committed Aug 14, 2023
1 parent 3e5d427 commit 074a870
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions pkg/conf/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ type Environment struct {
ExtraDomainIP string `yaml:"extraDomainIp"`
IngressClass string `yaml:"ingressClass"`
RepairInterval int `yaml:"repairInterval"`
PingInterval int `yaml:"pingInterval"`
Resources struct {
Limits struct {
CPU string `yaml:"cpu"`
Expand Down
5 changes: 4 additions & 1 deletion pkg/workers/ping/workers.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package ping

import (
deploymentModels "go-deploy/models/sys/deployment"
"go-deploy/pkg/conf"
"go-deploy/pkg/sys"
"go-deploy/service/deployment_service"
"log"
Expand All @@ -17,13 +18,15 @@ func deploymentPingUpdater(ctx *sys.Context) {
}

updateAllDeploymentPings()
time.Sleep(30 * time.Second)
time.Sleep(time.Duration(conf.Env.Deployment.PingInterval) * time.Second)
}
}

func updateAllDeploymentPings() {
deployments, _ := deployment_service.GetAll()

log.Println("pinging", len(deployments), "deployments")

for _, deployment := range deployments {

url := getURL(&deployment)
Expand Down

0 comments on commit 074a870

Please sign in to comment.