public ConcurrencyStatus GetStatus()

in src/Microsoft.Azure.WebJobs.Host/Scale/ConcurrencyManager.cs [81:127]


        public ConcurrencyStatus GetStatus(string functionId)
        {
            if (string.IsNullOrEmpty(functionId))
            {
                throw new ArgumentNullException(nameof(functionId));
            }

            // because this method won't be called concurrently for the same function ID, we can make
            // updates to the function specific status below without locking.
            var functionConcurrencyStatus = GetFunctionConcurrencyStatus(functionId);

            if (!functionConcurrencyStatus.CanAdjustConcurrency())
            {
                // if we've made an adjustment recently for this function, just return the
                // current status
                return functionConcurrencyStatus;
            }

            // determine whether any throttles are currently enabled
            _throttleStatus = _concurrencyThrottleManager.GetStatus();
            if (_throttleStatus.State == ThrottleState.Unknown)
            {
                // if we're un an unknown state, we'll make no moves
                // however, we will continue to take work at the current concurrency level
                return functionConcurrencyStatus;
            }

            if (_throttleStatus.State == ThrottleState.Disabled)
            {
                if (CanIncreaseConcurrency(functionConcurrencyStatus))
                {
                    _logger.FunctionConcurrencyIncrease(functionId);
                    functionConcurrencyStatus.IncreaseConcurrency();
                }
            }
            else if (CanDecreaseConcurrency(functionConcurrencyStatus))
            {
                string enabledThrottles = _throttleStatus.EnabledThrottles != null ? string.Join(",", _throttleStatus.EnabledThrottles) : string.Empty;
                _logger.FunctionConcurrencyDecrease(functionId, enabledThrottles);

                functionConcurrencyStatus.DecreaseConcurrency();
            }

            functionConcurrencyStatus.LogUpdates(_logger);

            return functionConcurrencyStatus;
        }