mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
fn: introducing 503 responses for out of capacity case (#518)
* fn: introducing 503 responses for out of capacity case *) Adding 503 with Retry-After header case if request failed during waiting for slots. *) TODO: return 503 without Retry-After if the request can never be met by this fn server. *) fn: runner test docker pull fixup *) fn: MaxMemory for routes is now a variable to allow testing and adjusting it according to fleet memory sizes.
This commit is contained in:
@@ -32,6 +32,11 @@ func HandleErrorResponse(ctx context.Context, w http.ResponseWriter, err error)
|
||||
if e.Code() >= 500 {
|
||||
log.WithFields(logrus.Fields{"code": e.Code()}).WithError(e).Error("api error")
|
||||
}
|
||||
if err == models.ErrCallTimeoutServerBusy {
|
||||
// TODO: Determine a better delay value here (perhaps ask Agent). For now 15 secs with
|
||||
// the hopes that fnlb will land this on a better server immediately.
|
||||
w.Header().Set("Retry-After", "15")
|
||||
}
|
||||
statuscode = e.Code()
|
||||
} else {
|
||||
log.WithError(err).WithFields(logrus.Fields{"stack": string(debug.Stack())}).Error("internal server error")
|
||||
|
||||
Reference in New Issue
Block a user