Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit fc21393

Browse files
committed
revert debug info
1 parent 3acce47 commit fc21393

File tree

1 file changed

+3
-28
lines changed

1 file changed

+3
-28
lines changed

src/ServiceStack.Redis/RedisManagerPool.cs

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -116,21 +116,17 @@ public void FailoverTo(IEnumerable<string> readWriteHosts, IEnumerable<string> r
116116
/// <returns></returns>
117117
public IRedisClient GetClient()
118118
{
119-
int section = 1;
120119
try
121120
{
122121
var inactivePoolIndex = -1;
123122
lock (clients)
124123
{
125-
section = 2;
126124
AssertValidPool();
127125

128-
section = 3;
129126
RedisClient inActiveClient;
130127
//-1 when no available clients otherwise index of reservedSlot or existing Client
131128
inactivePoolIndex = GetInActiveClient(out inActiveClient);
132129

133-
section = 4;
134130
//inActiveClient != null only for Valid InActive Clients
135131
if (inActiveClient != null)
136132
{
@@ -144,36 +140,28 @@ public IRedisClient GetClient()
144140
//Reaches here when there's no Valid InActive Clients
145141
try
146142
{
147-
section = 5;
148143
//inactivePoolIndex == -1 || index of reservedSlot || index of invalid client
149144
var existingClient = inactivePoolIndex >= 0 && inactivePoolIndex < clients.Length
150145
? clients[inactivePoolIndex]
151146
: null;
152147

153-
section = 5;
154148
if (existingClient != null && existingClient != reservedSlot && existingClient.HadExceptions)
155149
{
156-
section = 6;
157150
RedisState.DeactivateClient(existingClient);
158151
}
159152

160-
section = 7;
161-
var newClient = RedisResolver.CreateMasterClient(Math.Max(inactivePoolIndex, 0));
162-
section = 8;
163-
newClient = InitNewClient(newClient);
153+
var newClient = InitNewClient(RedisResolver.CreateMasterClient(Math.Max(inactivePoolIndex, 0)));
164154

165155
//Put all blocking I/O or potential Exceptions before lock
166156
lock (clients)
167157
{
168158
//Create new client outside of pool when max pool size exceeded
169159
//Reverting free-slot not needed when -1 since slwo wasn't reserved or
170160
//when existingClient changed (failover) since no longer reserver
171-
section = 9;
172161
var stillReserved = inactivePoolIndex >= 0 && inactivePoolIndex < clients.Length &&
173-
clients[inactivePoolIndex] == existingClient;
162+
clients[inactivePoolIndex] == existingClient;
174163
if (inactivePoolIndex == -1 || !stillReserved)
175164
{
176-
section = 10;
177165
if (Log.IsDebugEnabled)
178166
Log.Debug("clients[inactivePoolIndex] != existingClient: {0}".Fmt(!stillReserved ? "!stillReserved" : "-1"));
179167

@@ -184,7 +172,6 @@ public IRedisClient GetClient()
184172
return newClient;
185173
}
186174

187-
section = 11;
188175
poolIndex++;
189176
clients[inactivePoolIndex] = newClient;
190177
return newClient;
@@ -195,7 +182,6 @@ public IRedisClient GetClient()
195182
//Revert free-slot for any I/O exceptions that can throw (before lock)
196183
lock (clients)
197184
{
198-
section = 12;
199185
if (inactivePoolIndex >= 0 && inactivePoolIndex < clients.Length)
200186
{
201187
clients[inactivePoolIndex] = null;
@@ -204,20 +190,9 @@ public IRedisClient GetClient()
204190
throw;
205191
}
206192
}
207-
catch (IndexOutOfRangeException ex)
208-
{
209-
throw new Exception("Error after section: " + section, ex);
210-
}
211193
finally
212194
{
213-
try
214-
{
215-
RedisState.DisposeExpiredClients();
216-
}
217-
catch (IndexOutOfRangeException ex)
218-
{
219-
throw new Exception("Error at RedisState.DisposeExpiredClients()", ex);
220-
}
195+
RedisState.DisposeExpiredClients();
221196
}
222197
}
223198

0 commit comments

Comments
 (0)