engine: add timeout for service watch#1181
Conversation
| defer cancel() | ||
| ch, err := w.kCli.WatchServices(ctx2, []model.LabelPair{k8s.TiltRunLabel()}) | ||
| if err != nil { | ||
| err = errors.Wrap(err, "Error watching services. Are you connected to kubernetes?\n") |
There was a problem hiding this comment.
"Are you connected to Kubernetes" is not a helpful error message if we timed out, I might remove that bit and trust the err to contain the relevant context.
There was a problem hiding this comment.
fwiw, i thought we added that precisely because we got user reports that they didn't understand the error message. there are a wide variety of weird error messages you can get from this function
There was a problem hiding this comment.
Right, but if we get this error due to a timeout, it doesn't imply that we're not connected to k8s, right, but rather that something ELSE is wrong? in that case, the hint "are you connected to k8s" sends the user down a rabbit hole.
| defer cancel() | ||
| ch, err := w.kCli.WatchServices(ctx2, []model.LabelPair{k8s.TiltRunLabel()}) | ||
| if err != nil { | ||
| err = errors.Wrap(err, "Error watching services. Are you connected to kubernetes?\n") |
There was a problem hiding this comment.
fwiw, i thought we added that precisely because we got user reports that they didn't understand the error message. there are a wide variety of weird error messages you can get from this function
| ch, err := w.kCli.WatchServices(ctx, []model.LabelPair{k8s.TiltRunLabel()}) | ||
| ctx2, cancel := context.WithTimeout(ctx, 5*time.Second) | ||
| defer cancel() | ||
| ch, err := w.kCli.WatchServices(ctx2, []model.LabelPair{k8s.TiltRunLabel()}) |
There was a problem hiding this comment.
can you also update WatchPods? there's no guarantee which one will run first
b3ee398 to
9d68f2e
Compare
9d68f2e to
b49e29c
Compare
cb3dd78 to
8c65ed4
Compare
This may fix a problem Frank saw with Tilt hanging forever upon start when his Kube cluster wasn't ready