Skip to content

Commit

Permalink
Merge pull request #27 from Oats87/proper-duration
Browse files Browse the repository at this point in the history
use proper duration parsing to ensure that probes do not immediately …
  • Loading branch information
Oats87 authored Jun 1, 2021
2 parents f7af6af + 1faec3e commit e4050c3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pkg/prober/prober.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ type ProbeStatus struct {
func DoProbe(probe Probe, probeStatus *ProbeStatus, initial bool) error {
logrus.Tracef("Running probe %v", probe)
if initial {
logrus.Debugf("sleeping for %d seconds before running probe", probe.InitialDelaySeconds)
time.Sleep(time.Duration(probe.InitialDelaySeconds))
initialDelayDuration := time.Duration(probe.InitialDelaySeconds) * time.Second
logrus.Debugf("sleeping for %.0f seconds before running probe", initialDelayDuration.Seconds())
time.Sleep(initialDelayDuration)
}

var k8sProber k8shttp.Prober
Expand Down Expand Up @@ -83,7 +84,10 @@ func DoProbe(probe Probe, probeStatus *ProbeStatus, initial bool) error {
return err
}

probeResult, output, err := k8sProber.Probe(probeURL, http.Header{}, time.Duration(probe.TimeoutSeconds))
probeDuration := time.Duration(probe.TimeoutSeconds) * time.Second
logrus.Debugf("Probe timeout duration: %.0f seconds", probeDuration.Seconds())

probeResult, output, err := k8sProber.Probe(probeURL, http.Header{}, probeDuration)

if err != nil {
logrus.Errorf("error while running probe: %v", err)
Expand Down

0 comments on commit e4050c3

Please sign in to comment.