mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
fn: minor error code simplification (#1341)
There is no need to propagate CapacityFull to waitHot(). Instead waitHot() can receive 503 which is easier to follow (and less error prone) in handleCallEnd().
This commit is contained in:
@@ -311,19 +311,19 @@ func (a *agent) handleCallEnd(ctx context.Context, call *call, slot Slot, err er
|
|||||||
statsStopRun(ctx)
|
statsStopRun(ctx)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
statsComplete(ctx)
|
statsComplete(ctx)
|
||||||
|
} else if err == context.DeadlineExceeded {
|
||||||
|
statsTimedout(ctx)
|
||||||
|
return models.ErrCallTimeout
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
statsDequeue(ctx)
|
statsDequeue(ctx)
|
||||||
if err == CapacityFull || err == context.DeadlineExceeded {
|
if err == models.ErrCallTimeoutServerBusy || err == context.DeadlineExceeded {
|
||||||
statsTooBusy(ctx)
|
statsTooBusy(ctx)
|
||||||
return models.ErrCallTimeoutServerBusy
|
return models.ErrCallTimeoutServerBusy
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err == context.DeadlineExceeded {
|
if err == context.Canceled {
|
||||||
statsTimedout(ctx)
|
|
||||||
return models.ErrCallTimeout
|
|
||||||
} else if err == context.Canceled {
|
|
||||||
statsCanceled(ctx)
|
statsCanceled(ctx)
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
statsErrors(ctx)
|
statsErrors(ctx)
|
||||||
@@ -487,7 +487,7 @@ func (a *agent) checkLaunch(ctx context.Context, call *call, caller slotCaller)
|
|||||||
notifyChans = a.evictor.PerformEviction(call.slotHashId, needMem, uint64(needCpu))
|
notifyChans = a.evictor.PerformEviction(call.slotHashId, needMem, uint64(needCpu))
|
||||||
// For Non-blocking mode, if there's nothing to evict, we emit 503.
|
// For Non-blocking mode, if there's nothing to evict, we emit 503.
|
||||||
if len(notifyChans) == 0 && isNB {
|
if len(notifyChans) == 0 && isNB {
|
||||||
tryNotify(caller.notify, tok.Error())
|
tryNotify(caller.notify, models.ErrCallTimeoutServerBusy)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if a.shutWg.AddSession(1) {
|
} else if a.shutWg.AddSession(1) {
|
||||||
|
|||||||
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@@ -196,8 +196,8 @@ go.opencensus.io
|
|||||||
# golang.org/x/crypto v0.0.0-20181015023909-0c41d7ab0a0e
|
# golang.org/x/crypto v0.0.0-20181015023909-0c41d7ab0a0e
|
||||||
golang.org/x/crypto/ssh/terminal
|
golang.org/x/crypto/ssh/terminal
|
||||||
# golang.org/x/net v0.0.0-20181017193950-04a2e542c03f
|
# golang.org/x/net v0.0.0-20181017193950-04a2e542c03f
|
||||||
golang.org/x/net/context
|
|
||||||
golang.org/x/net/trace
|
golang.org/x/net/trace
|
||||||
|
golang.org/x/net/context
|
||||||
golang.org/x/net/internal/timeseries
|
golang.org/x/net/internal/timeseries
|
||||||
golang.org/x/net/http2
|
golang.org/x/net/http2
|
||||||
golang.org/x/net/http2/hpack
|
golang.org/x/net/http2/hpack
|
||||||
|
|||||||
Reference in New Issue
Block a user