[ws-proxy] Wait for workspace info until the request is canceled#2305
[ws-proxy] Wait for workspace info until the request is canceled#2305
Conversation
1f1159d to
366d300
Compare
|
/werft run 👍 started the job as gitpod-build-cw-ws-proxy-wait-for-info.2 |
|
Started reviewing the code, will then have a closer look with |
There was a problem hiding this comment.
Why not have the c.cond.Broadcast() here instead of in doInsert? It would help separate concerns (locking/notification) from insertion.
There was a problem hiding this comment.
I've moved here - and into Reinit - because then
- we don't signal that much during reinit (one broadcast after all insertions)
- the cond.Broadcast() is closer to the locking.
There was a problem hiding this comment.
A comment on what the cond signal means. Here it's used as "some new info available" if I'm not mistaken (as opposed to "data has changed (added/removed)" as one might tempted to think).
There was a problem hiding this comment.
Do I understand correctly that we need this goroutine because we want to wait for - select - on a condition variable which is not selectable? And we use cond because we don't have the buffering problems and the cond code is nicer in the other places?
There was a problem hiding this comment.
Exactly, we have two things we want to wait for: context cancelation or info becoming available. We cannot select on the cond, hence need to "turn it into a channel". We use a cond because we have potentially multiple WaitFors waiting, and we cannot use a single channel directly (except with a much more complicated locked map).
|
I delayed |
366d300 to
0fefa20
Compare
geropl
left a comment
There was a problem hiding this comment.
Cool! 🚀
(build fails bc gofmt only)
0fefa20 to
89b3c19
Compare
This PR makes ws-proxy wait for workspace info.
We wait for workspace info to arrive until the request context is canceled.
fixes #2299
How to test
Place a lot of load on the system, or artificially delay the ws-man subscription e.g. using blowtorch.
Also, there's a unit test :)