Skip to content

Commit 9bc0129

Browse files
mathewcmhoeger
authored andcommitted
Removing process limit (CPU) checks from http throttle (#6986)
1 parent 5992563 commit 9bc0129

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/WebJobs.Script.WebHost/Middleware/HttpThrottleMiddleware.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public async Task Invoke(HttpContext httpContext, IOptions<HttpOptions> httpOpti
4747
{
4848
// only check host status periodically
4949
Collection<string> exceededCounters = new Collection<string>();
50-
_rejectRequests = await performanceManager.IsUnderHighLoadAsync(exceededCounters);
50+
_rejectRequests = performanceManager.PerformanceCountersExceeded(exceededCounters);
5151
_lastPerformanceCheck = DateTime.UtcNow;
5252
if (_rejectRequests)
5353
{

test/WebJobs.Script.Tests/Middleware/HttpThrottleMiddlewareTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ public async Task Invoke_HostIsOverloaded_RequestsAreRejected()
235235
_requestQueue = new HttpRequestQueue(new OptionsWrapper<HttpOptions>(_httpOptions));
236236

237237
bool isOverloaded = false;
238-
_performanceManager.Setup(p => p.IsUnderHighLoadAsync(It.IsAny<Collection<string>>(), null)).Returns(() => Task.FromResult(isOverloaded));
238+
_performanceManager.Setup(p => p.PerformanceCountersExceeded(It.IsAny<Collection<string>>(), It.IsAny<ILogger>())).Returns(() => isOverloaded);
239239

240240
RequestDelegate next = async (ctxt) =>
241241
{
@@ -269,7 +269,7 @@ public async Task Invoke_UnderLoad_RequestsAreRejected()
269269

270270
bool highLoad = false;
271271
int highLoadQueryCount = 0;
272-
_performanceManager.Setup(p => p.IsUnderHighLoadAsync(It.IsAny<Collection<string>>(), It.IsAny<ILogger>()))
272+
_performanceManager.Setup(p => p.PerformanceCountersExceeded(It.IsAny<Collection<string>>(), It.IsAny<ILogger>()))
273273
.Callback<Collection<string>, ILogger>((exceededCounters, tw) =>
274274
{
275275
if (highLoad)
@@ -280,7 +280,7 @@ public async Task Invoke_UnderLoad_RequestsAreRejected()
280280
}).Returns(() =>
281281
{
282282
highLoadQueryCount++;
283-
return Task.FromResult(highLoad);
283+
return highLoad;
284284
});
285285

286286
// issue some requests while not under high load

0 commit comments

Comments
 (0)