File tree Expand file tree Collapse file tree 2 files changed +21
-10
lines changed
RabbitMQ.Client/src/client/impl Expand file tree Collapse file tree 2 files changed +21
-10
lines changed Original file line number Diff line number Diff line change @@ -92,22 +92,28 @@ public void init()
92
92
var self = this ;
93
93
ConnectionShutdownEventHandler recoveryListener = ( _ , args ) =>
94
94
{
95
- if ( ShouldTriggerConnectionRecovery ( args ) )
95
+ lock ( self )
96
96
{
97
- try
97
+ if ( ShouldTriggerConnectionRecovery ( args ) )
98
98
{
99
- self . BeginAutomaticRecovery ( ) ;
100
- } catch ( Exception e )
101
- {
102
- // TODO: logging
103
- Console . WriteLine ( "BeginAutomaticRecovery() failed: {0}" , e ) ;
104
- }
99
+ try
100
+ {
101
+ self . BeginAutomaticRecovery ( ) ;
102
+ } catch ( Exception e )
103
+ {
104
+ // TODO: logging
105
+ Console . WriteLine ( "BeginAutomaticRecovery() failed: {0}" , e ) ;
106
+ }
107
+ }
105
108
}
106
109
} ;
107
110
lock ( this . m_eventLock )
108
111
{
109
112
this . ConnectionShutdown += recoveryListener ;
110
- this . m_recordedShutdownEventHandlers . Add ( recoveryListener ) ;
113
+ if ( ! this . m_recordedShutdownEventHandlers . Contains ( recoveryListener ) )
114
+ {
115
+ this . m_recordedShutdownEventHandlers . Add ( recoveryListener ) ;
116
+ }
111
117
}
112
118
}
113
119
@@ -837,7 +843,7 @@ public void DeleteRecordedBinding(RecordedBinding rb)
837
843
}
838
844
}
839
845
840
- public void RecordConsumer ( string name , RecordedConsumer c )
846
+ public void RecordConsumer ( string name , RecordedConsumer c )
841
847
{
842
848
lock ( this . m_recordedEntitiesLock )
843
849
{
Original file line number Diff line number Diff line change @@ -518,6 +518,7 @@ public void TestConsumerRecoveryWithManyConsumers()
518
518
}
519
519
520
520
[ Test ]
521
+ [ Category ( "Focus" ) ]
521
522
public void TestConsumerRecoveryOnClientNamedQueueWithOneRecovery ( )
522
523
{
523
524
var c = CreateAutorecoveringConnection ( ) ;
@@ -535,6 +536,10 @@ public void TestConsumerRecoveryOnClientNamedQueueWithOneRecovery()
535
536
latestName = current ;
536
537
} ;
537
538
539
+ CloseAndWaitForRecovery ( c ) ;
540
+ AssertConsumerCount ( m , latestName , 1 ) ;
541
+ CloseAndWaitForRecovery ( c ) ;
542
+ AssertConsumerCount ( m , latestName , 1 ) ;
538
543
CloseAndWaitForRecovery ( c ) ;
539
544
AssertConsumerCount ( m , latestName , 1 ) ;
540
545
You can’t perform that action at this time.
0 commit comments