File tree Expand file tree Collapse file tree 1 file changed +19
-8
lines changed
src/ServiceStack.Redis/Messaging Expand file tree Collapse file tree 1 file changed +19
-8
lines changed Original file line number Diff line number Diff line change @@ -237,19 +237,30 @@ public void Start()
237
237
238
238
SleepBackOffMultiplier ( Interlocked . CompareExchange ( ref noOfContinuousErrors , 0 , 0 ) ) ;
239
239
240
- KillBgThreadIfExists ( ) ;
240
+ StartWorkerThreads ( ) ;
241
241
242
- bgThread = new Thread ( RunLoop ) {
243
- IsBackground = true ,
244
- Name = "Redis MQ Server " + Interlocked . Increment ( ref bgThreadCount )
245
- } ;
246
- bgThread . Start ( ) ;
247
- Log . Debug ( "Started Background Thread: " + bgThread . Name ) ;
242
+ //Don't kill us if we're the thread that's retrying to Start() after a failure.
243
+ if ( bgThread != Thread . CurrentThread )
244
+ {
245
+ KillBgThreadIfExists ( ) ;
248
246
249
- StartWorkerThreads ( ) ;
247
+ bgThread = new Thread ( RunLoop )
248
+ {
249
+ IsBackground = true ,
250
+ Name = "Redis MQ Server " + Interlocked . Increment ( ref bgThreadCount )
251
+ } ;
252
+ bgThread . Start ( ) ;
253
+ Log . Debug ( "Started Background Thread: " + bgThread . Name ) ;
254
+ }
255
+ else
256
+ {
257
+ Log . Debug ( "Retrying RunLoop() on Thread: " + bgThread . Name ) ;
258
+ RunLoop ( ) ;
259
+ }
250
260
}
251
261
catch ( Exception ex )
252
262
{
263
+ ex . Message . Print ( ) ;
253
264
if ( this . ErrorHandler != null ) this . ErrorHandler ( ex ) ;
254
265
}
255
266
}
You can’t perform that action at this time.
0 commit comments