mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
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:
@@ -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
|
||||
|
||||
@@ -32,7 +32,7 @@ If `FN_FORMAT` is `http-stream`, then absence of `FN_LISTENER` or "unix:" prefix
|
||||
|
||||
Before exiting, FDKs __SHOULD__ remove the UDS file (from `FN_LISTENER` path).
|
||||
|
||||
FDKs upon creation of UDS file on disk with bind system call __SHOULD__ be ready to receive and handle traffic. Upon bind call, the UDS file __MUST__ be writable by fn-agent.
|
||||
FDKs upon creation of UDS file on disk with bind system call __SHOULD__ be ready to receive and handle traffic. Upon bind call, the UDS file __MUST__ be writable by fn-agent. In order to create a properly permissioned UDS file, FDKs __MUST__ create a file with [at least] permissions of `0666`, if the language provides support for creating this file with the right permissions this may be easily achieved; users may alternatively bind to a file that is not `FN_LISTENER`, modify its permissions to the required setting, and then symlink that file to `FN_LISTENER` (see fdk-go for an example).
|
||||
|
||||
Path in `FN_LISTENER` (after "unix:" prefix) cannot be larger than 107 bytes.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user