I am setting every 24 hour 1 request. But the quto policy allowing after 30 min 1 request.
I am using java script to set limit : setRatelimit.js
var quotaLimit = "1";
var quotaInterval = "24";
var quotaTimeUnit = "hour";
Policy: EnforceQuota
<Quota async="false" continueOnError="false" enabled="true" name="EnforceQuota">
<DisplayName>EnforceQuota</DisplayName>
<Distributed>true</Distributed>
<Synchronous>true</Synchronous>
<Interval ref="quota_interval"/>
<TimeUnit ref="quota_time_unit"/>
<Allow countRef="quota_limit"/>
<Identifier ref="refIdentifier"/>
can any one let me know why the Quota policy allowing after 30 min ?
Thanks in advance.
@kumarsathe , What do you see in trace ? What values does ref variables quota_interval , quota_time_unit , quota_limit holds ?
In trace quota_interval 24 quota_limit 1 quota_time_unit hour
ratelimit.EnforceQuota.expiry.time - 1469869200199 [Not sure what is number refers ms/nano sec]
@kumarsathe , I believe it's unix epoch timestamp in milliseconds. You can convert here to date time .
This helps, so ratelimit.EnforceQuota.expiry.time this also contains around 24 hours time. but it fails after 30 min
Hi @kumarsathe
You need to set the values to variables using
context.setVariable(variable_name,variable_value). |
Make sure, the names set to variables are same as the variable names being referenced in <Ref> tag of quota policy.
This is used to initialise the variable in javascript policy and not accessible outside the script.
var quotaLimit = "1"; |