update docs with pro tips for fdk http stream people (#1211)

* update docs with pro tips for fdk http stream people

* fix bug where container could die before uds wait

we used to hang out for an hour. oopsie, thanks Owen
This commit is contained in:
Reed Allman
2018-09-14 16:54:18 +01:00
committed by GitHub
parent 250853cb8a
commit 2b797a556a
2 changed files with 15 additions and 14 deletions

View File

@@ -925,19 +925,6 @@ func (a *agent) runHot(ctx context.Context, call *call, tok ResourceToken, state
return
}
// now we wait for the socket to be created before handing out any slots
select {
case err := <-udsAwait: // XXX(reed): need to leave a note about pairing ctx here?
// sends a nil error if all is good, we can proceed...
if err != nil {
call.slots.queueSlot(&hotSlot{done: make(chan struct{}), fatalErr: err})
return
}
case <-ctx.Done():
call.slots.queueSlot(&hotSlot{done: make(chan struct{}), fatalErr: ctx.Err()})
return
}
// container is running
state.UpdateState(ctx, ContainerStateIdle, call.slots)
@@ -949,6 +936,20 @@ func (a *agent) runHot(ctx context.Context, call *call, tok ResourceToken, state
go func() {
defer shutdownContainer() // also close if we get an agent shutdown / idle timeout
// now we wait for the socket to be created before handing out any slots, need this
// here in case the container dies before making the sock we need to bail
select {
case err := <-udsAwait: // XXX(reed): need to leave a note about pairing ctx here?
// sends a nil error if all is good, we can proceed...
if err != nil {
call.slots.queueSlot(&hotSlot{done: make(chan struct{}), fatalErr: err})
return
}
case <-ctx.Done():
call.slots.queueSlot(&hotSlot{done: make(chan struct{}), fatalErr: ctx.Err()})
return
}
for {
select { // make sure everything is up before trying to send slot
case <-ctx.Done(): // container shutdown