8000 fix(memcached-node): dispose semaphore on node disposed · cnblogs/EnyimMemcachedCore@b86cfae · GitHub
[go: up one dir, main page]

Skip to content

Commit b86cfae

Browse files
ZeekoZhucnblogs-dudu
authored andcommitted
fix(memcached-node): dispose semaphore on node disposed
See: #104
1 parent e3df77f commit b86cfae

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Enyim.Caching/Memcached/MemcachedNode.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,9 @@ public IPooledSocketResult Acquire()
136136
this.internalPoolImpl.InitPool();
137137
this.isInitialized = true;
138138
_logger.LogInformation("MemcachedInitPool-cost: {0}ms", (DateTime.Now - startTime).TotalMilliseconds);
139-
poolInitSemaphore.Release();
140139
}
141140
}
141+
142142
try
143143
{
144144
return this.internalPoolImpl.Acquire();
@@ -151,6 +151,10 @@ public IPooledSocketResult Acquire()
151151
result.Fail(message, e);
152152
return result;
153153
}
154+
finally
155+
{
156+
poolInitSemaphore.Release();
157+
}
154158
}
155159

156160
/// <summary>
@@ -210,6 +214,7 @@ public void Dispose()
210214

211215
this.isDisposed = true;
212216
this.internalPoolImpl.Dispose();
217+
this.poolInitSemaphore.Dispose();
213218
}
214219
}
215220

0 commit comments

Comments
 (0)
0