You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// AcquireConcurrencyToken attempts to acquire a token from the ConcurrencyManager to manage the number of concurrent requests.
18
+
// This function is designed to ensure that the HTTP client adheres to predefined concurrency limits, preventing an excessive number of simultaneous requests.
19
+
// It creates a new context with a timeout to avoid indefinite blocking in case the concurrency limit is reached.
20
+
// Upon successfully acquiring a token, it records the time taken to acquire the token and updates performance metrics accordingly.
21
+
// The function then adds the acquired request ID to the context, which can be used for tracking and managing individual requests.
22
+
//
23
+
// Parameters:
24
+
// - ctx: The parent context from which the new context with timeout will be derived. This allows for proper request cancellation and timeout handling.
25
+
// - log: An instance of a logger (conforming to the logger.Logger interface), used to log relevant information and errors during the token acquisition process.
26
+
//
27
+
// Returns:
28
+
// - A new context containing the acquired request ID, which should be passed to subsequent operations requiring concurrency control.
29
+
// - An error if the token could not be acquired within the timeout period or due to any other issues encountered by the ConcurrencyManager.
30
+
//
31
+
// Usage:
32
+
// This function should be called before making an HTTP request that needs to be controlled for concurrency.
33
+
// The returned context should be used for the HTTP request to ensure it is associated with the acquired concurrency token.
0 commit comments