fn: non-blocking resource tracker and notification (#841)

* fn: non-blocking resource tracker and notification

For some types of errors, we might want to notify
the actual caller if the error is directly 1-1 tied
to that request. If hotLauncher is triggered with
signaller, then here we send a back communication
error notification channel. This is passed to
checkLaunch to send back synchronous responses
to the caller that initiated this hot container
launch.

This is useful if we want to run the agent in
quick fail mode, where instead of waiting for
CPU/Mem to become available, we prefer to fail
quick in order not to hold up the caller.
To support this, non-blocking resource tracker
option/functions are now available.

* fn: test env var rename tweak

* fn: fixup merge

* fn: rebase test fix

* fn: merge fixup

* fn: test tweak down to 70MB for 128MB total

* fn: refactor token creation and use broadcast regardless

* fn: nb description

* fn: bugfix
This commit is contained in:
Tolga Ceylan
2018-04-24 21:59:33 -07:00
committed by Reed Allman
parent 51197d4985
commit 54ba49be65
6 changed files with 359 additions and 92 deletions

View File

@@ -50,7 +50,7 @@ type slotQueue struct {
cond *sync.Cond
slots []*slotToken
nextId uint64
signaller chan bool
signaller chan chan error
statsLock sync.Mutex // protects stats below
stats slotQueueStats
}
@@ -67,7 +67,7 @@ func NewSlotQueue(key string) *slotQueue {
key: key,
cond: sync.NewCond(new(sync.Mutex)),
slots: make([]*slotToken, 0),
signaller: make(chan bool, 1),
signaller: make(chan chan error, 1),
}
return obj