v0.3.0-unstable10

This commit is contained in:
Yann Stepienik 2023-05-01 00:56:10 +01:00
parent 9d6773f27b
commit ac3a53507d
2 changed files with 4 additions and 4 deletions

View file

@ -1,6 +1,6 @@
{ {
"name": "cosmos-server", "name": "cosmos-server",
"version": "0.3.0-unstable9", "version": "0.3.0-unstable10",
"description": "", "description": "",
"main": "test-server.js", "main": "test-server.js",
"bugs": { "bugs": {

View file

@ -186,7 +186,7 @@ func (shield *smartShieldState) computeThrottle(policy utils.SmartShieldPolicy,
overSim := policy.PerUserSimultaneous - userConsumed.Simultaneous overSim := policy.PerUserSimultaneous - userConsumed.Simultaneous
overSimRatio := float64(overSim) / float64(policy.PerUserSimultaneous) overSimRatio := float64(overSim) / float64(policy.PerUserSimultaneous)
if overSim < 0 { if overSim < 0 {
newThrottle := int(float64(20) * -overSimRatio) newThrottle := int(float64(50) * -overSimRatio)
if newThrottle > throttle { if newThrottle > throttle {
throttle = newThrottle throttle = newThrottle
} }
@ -240,10 +240,10 @@ func SmartShieldMiddleware(policy utils.SmartShieldPolicy) func(http.Handler) ht
policy.PolicyStrictness = 2 // NORMAL policy.PolicyStrictness = 2 // NORMAL
} }
if(policy.PerUserSimultaneous == 0) { if(policy.PerUserSimultaneous == 0) {
policy.PerUserSimultaneous = 10 policy.PerUserSimultaneous = 24
} }
if(policy.MaxGlobalSimultaneous == 0) { if(policy.MaxGlobalSimultaneous == 0) {
policy.MaxGlobalSimultaneous = 200 policy.MaxGlobalSimultaneous = 250
} }
if(policy.PrivilegedGroups == 0) { if(policy.PrivilegedGroups == 0) {
policy.PrivilegedGroups = utils.ADMIN policy.PrivilegedGroups = utils.ADMIN