File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
projects/Test/Integration Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ public async void TestConcurrentQueueDeclareAndBindAsync()
85
85
} ;
86
86
87
87
var tasks = new List < Task > ( ) ;
88
- var queueNames = new ConcurrentBag < string > ( ) ;
88
+ var queueNames = new ConcurrentDictionary < string , bool > ( ) ;
89
89
90
90
NotSupportedException nse = null ;
91
91
for ( int i = 0 ; i < 256 ; i ++ )
@@ -101,7 +101,10 @@ async Task f()
101
101
durable : false , exclusive : true , autoDelete : false ) ;
102
102
string queueName = r . QueueName ;
103
103
await _channel . QueueBindAsync ( queue : queueName , exchange : "amq.fanout" , routingKey : queueName ) ;
104
- queueNames . Add ( queueName ) ;
104
+ if ( false == queueNames . TryAdd ( queueName , true ) )
105
+ {
106
+ throw new InvalidOperationException ( $ "queue with name { queueName } already added!") ;
107
+ }
105
108
}
106
109
catch ( NotSupportedException e )
107
110
{
@@ -117,7 +120,7 @@ async Task f()
117
120
tasks . Clear ( ) ;
118
121
119
122
nse = null ;
120
- foreach ( string q in queueNames )
123
+ foreach ( string q in queueNames . Keys )
121
124
{
122
125
async Task f ( )
123
126
{
You can’t perform that action at this time.
0 commit comments