Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
- Use context for timeout
- do not override exec probe

Signed-off-by: Shash Reddy <shashwathireddy@gmail.com>
  • Loading branch information
joshrider authored and shashwathi committed Jul 16, 2019
1 parent a37f22b commit 468c0cd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 deletions.
11 changes: 3 additions & 8 deletions cmd/queue/main.go
Expand Up @@ -247,14 +247,9 @@ func probeQueueHealthPath(port int, timeoutSeconds int) error {
},
Timeout: timeoutDuration,
}

stopCh := make(chan struct{})
timeCh := time.After(timeoutDuration)

go func() {
<-timeCh
close(stopCh)
}()
ctx, cancel := context.WithTimeout(context.Background(), timeoutDuration)
defer cancel()
stopCh := ctx.Done()

var lastErr error
timeoutErr := wait.PollImmediateUntil(aggressivePollInterval, func() (bool, error) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/reconciler/revision/resources/deploy_test.go
Expand Up @@ -580,7 +580,7 @@ func TestMakePodSpec(t *testing.T) {
withExecReadinessProbe([]string{"echo", "hello"})),
queueContainer(
withEnvVar("CONTAINER_CONCURRENCY", "0"),
withEnvVar("SERVING_READINESS_PROBE", `{"tcpSocket":{"port":8080,"host":"127.0.0.1"},"successThreshold":1}`),
withEnvVar("SERVING_READINESS_PROBE", "{}"),
),
}),
}, {
Expand Down
7 changes: 1 addition & 6 deletions pkg/reconciler/revision/resources/queue.go
Expand Up @@ -336,12 +336,7 @@ func applyReadinessProbeDefaults(p *corev1.Probe, port int32) {
p.TCPSocket.Host = localAddress
p.TCPSocket.Port = intstr.FromInt(int(port))
case p.Exec != nil:
// Use default TCP connect probe to ensure data path is open from queue-proxy to
// user-container. User-defined ExecProbe will still be run on user-container.
p.TCPSocket = &corev1.TCPSocketAction{}
p.SuccessThreshold = 1
p.TCPSocket.Host = localAddress
p.TCPSocket.Port = intstr.FromInt(int(port))
//User-defined ExecProbe will still be run on user-container.
p.Exec = nil
}

Expand Down

0 comments on commit 468c0cd

Please sign in to comment.