add unloading setting for application

This commit is contained in:
DeniskaRediska committed 2019-11-20 13:41:45 +03:00
1 parent 37c08f4500
commit 8dcb8eef68
6 files changed
+112 -47

No files matched your search

+2 -3
View File
@@ -77,12 +77,11 @@ func (handlerHelper) AuthenticateAccountingProxy(ctx *fasthttp.RequestCtx) domai
return domain.Create().SetError(err)
}
if account := accounting.GetAccounting(applicationId); account != nil && !account.Accept(path) {
if !accounting.Accept(applicationId, path) {
err := errors.New("accounting error")
utils.WriteError(ctx, "forbidden", codes.ResourceExhausted, nil)
utils.WriteError(ctx, "too many requests", codes.ResourceExhausted, nil)
return domain.Create().SetError(err)
}
go accounting.Unload.TakeRequest(applicationId, path, time.Now())
return p.ProxyRequest(ctx)
}