aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Jan Tattermusch <jtattermusch@google.com>2017-11-28 10:27:54 +0100
committerGravatar Jan Tattermusch <jtattermusch@google.com>2017-11-28 13:42:49 +0100
commit53bbde3c490a6dda7d80aad329df739efb5f1cf5 (patch)
tree2158dd6040bc9d46dbd216a1e399ecea792fc82d
parent21cde3d22a113969fb135ae765473fb79b3de405 (diff)
address comments
-rw-r--r--src/csharp/Grpc.Core/Internal/DefaultObjectPool.cs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/csharp/Grpc.Core/Internal/DefaultObjectPool.cs b/src/csharp/Grpc.Core/Internal/DefaultObjectPool.cs
index 37c9ae06fe..2f030f3e02 100644
--- a/src/csharp/Grpc.Core/Internal/DefaultObjectPool.cs
+++ b/src/csharp/Grpc.Core/Internal/DefaultObjectPool.cs
@@ -59,7 +59,7 @@ namespace Grpc.Core.Internal
this.sharedCapacity = sharedCapacity;
this.threadLocalData = new ThreadLocal<ThreadLocalData>(() => new ThreadLocalData(threadLocalCapacity), false);
this.threadLocalCapacity = threadLocalCapacity;
- this.rentLimit = threadLocalCapacity / 2;
+ this.rentLimit = threadLocalCapacity != 1 ? threadLocalCapacity / 2 : 1;
}
/// <summary>
@@ -104,7 +104,7 @@ namespace Grpc.Core.Internal
// next time we try to lease we will just create those
// instead of trying to grab them from the shared queue.
// This is to guarantee we won't be accessing the shared queue too often.
- localData.CreateBudget += rentLimit - itemsMoved;
+ localData.CreateBudget = rentLimit - itemsMoved;
return leasedItem ?? itemFactory();
}
@@ -156,7 +156,7 @@ namespace Grpc.Core.Internal
// next time we try to return we will just dispose the item
// instead of trying to return them to the shared queue.
// This is to guarantee we won't be accessing the shared queue too often.
- localData.DisposeBudget += returnLimit - itemsReturned;
+ localData.DisposeBudget = returnLimit - itemsReturned;
if (itemsReturned == 0)
{