Restrict Restriction Algorithm
In order to restrict invocation requests from a certain address or user. A preemptive restriction algorithm is provided.
The total number of rule invocations can be limited for a user.
A user can be limited to a cool-down interval between the current invocation and the previous invocation.
mode
mode determines the mode of restriction, pass 0 for rule level restriction, pass 1 for task level restriction, pass 2 to disable the function, pass 0 or 1 again to restore the function. The parentId of a task will be limited, for example, red packet algorithm, create a red packet, generate a taskId 1, when other people take taskId 1 to get the red packet, a new taskId will be generated, so the restriction is on the parent id, there is no point to restrict the new id.
maxCount
maxCount limits the maximum number of times each address can be called, pass 0 to set no limit.
timeLimit
timeLimit limits the interval between calls for each address, for example, 100 means it takes more than 100s from the last call, if you pass 0, there is no such limit.
timeLimitGlobal
timeLimitGlobal limits the amount of time a rule can be invoked, regardless of the user, if 100 is set, the next time a rule is invoked, the next time the rule is invoked, the next time the rule is invoked.
If it is set to 100, the next time a rule is invoked will take 100s, if it is set to 0, there is no limit.
taskTotalCount
Determine how many times a task can be called, pass 0 to set no limit.
taskTimeLimitGlobal
Decide how long a task can be called, pass 0 to set no limit.
taskMaxCount
Decide the maximum number of times a task can be called from a single address, pass 0 to set no limit.
taskTimeLimit
Decide the time between calls to a task by an address, pass 0 to not limit.
Last updated