mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
fn: exclude timeouts from failed error count (#590)
* fn: exclude timeouts from failed error count
This commit is contained in:
@@ -175,6 +175,16 @@ func transformTimeout(e error, isRetriable bool) error {
|
|||||||
return e
|
return e
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// handleStatsDequeue handles stats for dequeuing for early exit (getSlot or Start)
|
||||||
|
// cases. Only timeouts can be a simple dequeue while other cases are actual errors.
|
||||||
|
func (a *agent) handleStatsDequeue(err error, callI Call) {
|
||||||
|
if err == context.DeadlineExceeded {
|
||||||
|
a.stats.Dequeue(callI.Model().AppName, callI.Model().Path)
|
||||||
|
} else {
|
||||||
|
a.stats.DequeueAndFail(callI.Model().AppName, callI.Model().Path)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (a *agent) Submit(callI Call) error {
|
func (a *agent) Submit(callI Call) error {
|
||||||
a.wg.Add(1)
|
a.wg.Add(1)
|
||||||
defer a.wg.Done()
|
defer a.wg.Done()
|
||||||
@@ -210,7 +220,7 @@ func (a *agent) Submit(callI Call) error {
|
|||||||
|
|
||||||
slot, err := a.getSlot(ctx, call) // find ram available / running
|
slot, err := a.getSlot(ctx, call) // find ram available / running
|
||||||
if err != nil {
|
if err != nil {
|
||||||
a.stats.DequeueAndFail(callI.Model().AppName, callI.Model().Path)
|
a.handleStatsDequeue(err, call)
|
||||||
return transformTimeout(err, true)
|
return transformTimeout(err, true)
|
||||||
}
|
}
|
||||||
// TODO if the call times out & container is created, we need
|
// TODO if the call times out & container is created, we need
|
||||||
@@ -220,7 +230,7 @@ func (a *agent) Submit(callI Call) error {
|
|||||||
// TODO Start is checking the timer now, we could do it here, too.
|
// TODO Start is checking the timer now, we could do it here, too.
|
||||||
err = call.Start(ctx)
|
err = call.Start(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
a.stats.DequeueAndFail(callI.Model().AppName, callI.Model().Path)
|
a.handleStatsDequeue(err, call)
|
||||||
return transformTimeout(err, true)
|
return transformTimeout(err, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user