TestRunLimits Class

Assembly: CodeEffects.Rule.Repository.dll
Namespace: CodeEffects.Rule.Repository

Summary

Sets how many saved tests one AI agent or one service may run per call and per hour, and how many runs it may have under way at once.

Syntax

public class TestRunLimits

Remarks

Use it through the AgentTestLimits and ServiceTestLimits properties of AgentSettings. Which of the two applies depends on CurrentUserType of the request's configuration: UserType.Service uses the service limits, anything else uses the agent limits. See UserType.

The counts are kept for each caller, identified by the current user ID together with the current agent ID, in the memory of each server instance. When several instances run behind a load balancer, the real limit is the setting multiplied by the number of instances. The hour is a sliding window, and a test counts when it is taken, not when the call ends; tests that a call does not run are given back.

A call that names more tests than TestsPerCall is refused with the control number CE10236. A call that would pass TestsPerHour, or that starts while the caller already has TestsAtOnce runs under way, is refused with the control number CE10234, and the answer tells the caller how many seconds to wait.

The Rule Repository's own batch runner, which people use, is not limited by these settings.

Constructors

  • TestRunLimits()

    Initializes a new instance of the TestRunLimits class with the default values of all properties.

Properties

  • TestsAtOnce

    Type: System.Int32

    Gets or sets the most runs that one caller may have under way at once. A call that runs several tests counts as one run. The default value is 2.

  • TestsPerCall

    Type: System.Int32

    Gets or sets the most saved tests that one call may run. The default value is 10.

  • TestsPerHour

    Type: System.Int32

    Gets or sets the most saved tests that one caller may run in any hour, counting tests, not calls. The default value is 100.

    Example

      using CodeEffects.Rule.Repository;
    
      var agents = new AgentSettings
      {
      	AgentTestLimits = new TestRunLimits { TestsPerCall = 5, TestsPerHour = 50, TestsAtOnce = 1 }
      };
    

Ask on Stack Overflow - Yes, it's still active
Ask in GitHub Discussions

p102

l097 --

l102

p101

×