kopia lustrzana https://github.com/bugout-dev/moonstream
Take into account calls during current session
rodzic
e199d5bb1a
commit
647cccb99f
|
@ -45,7 +45,7 @@ func (ca *ClientAccess) CheckClientCallPeriodLimits(tsNow int64) bool {
|
|||
isClientAllowedToGetAccess := false
|
||||
if tsNow-ca.ClientResourceData.PeriodStartTs < ca.ClientResourceData.PeriodDuration {
|
||||
// Client operates in period
|
||||
if ca.ClientResourceData.CallsPerPeriod < ca.ClientResourceData.MaxCallsPerPeriod {
|
||||
if ca.ClientResourceData.CallsPerPeriod+ca.LastSessionCallsCounter < ca.ClientResourceData.MaxCallsPerPeriod {
|
||||
// Client's limit of calls not reached
|
||||
isClientAllowedToGetAccess = true
|
||||
}
|
||||
|
|
|
@ -31,8 +31,8 @@ var (
|
|||
NB_HEALTH_CHECK_CALL_TIMEOUT = time.Second * 2
|
||||
|
||||
NB_CACHE_CLEANING_INTERVAL = time.Second * 10
|
||||
NB_CACHE_ACCESS_ID_LIFETIME = int64(120) // TODO(kompotkot): Set to 2 mins
|
||||
NB_CACHE_ACCESS_ID_SESSION_LIFETIME = int64(600) // TODO(kompotkot): Set to 10 mins
|
||||
NB_CACHE_ACCESS_ID_LIFETIME = int64(120) // 2 minutes
|
||||
NB_CACHE_ACCESS_ID_SESSION_LIFETIME = int64(600) // 10 minutes
|
||||
|
||||
NB_MAX_COUNTER_NUMBER = uint64(10000000)
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue