Method BeginRequestAsync
- Namespace
- IntentSharp.Specialist
- Assembly
- IntentSharp.Specialist.dll
BeginRequestAsync(string, string, int, DateTimeOffset, CancellationToken)
Called by the runtime before it sends a request, to decide who sends it: returns the ticket when one is already
recorded for the intent and request hash; the hourly limit when the intent had maxRequestsPerHour
requests in the hour before now; that another caller is sending it; or that this caller sends
it, in which case the request is recorded at now and counts toward the limit. The default reads
the ticket and the count and then records the request, which is not atomic: a store that several processes share
overrides it so that one of them sends each request and the limit holds across them, as
DocumentSpecialistStore does.
ValueTask<SpecialistRequestClaim> BeginRequestAsync(string intentName, string requestHash, int maxRequestsPerHour, DateTimeOffset now, CancellationToken cancellationToken)
Parameters
intentNamestringThe intent's name.
requestHashstringThe request hash.
maxRequestsPerHourintThe most requests allowed for the intent in any hour.
nowDateTimeOffsetThe time of the request.
cancellationTokenCancellationTokenCancels the call.
Returns
- ValueTask<SpecialistRequestClaim>